正确的Ruby on Rails Database.yml文件的MySQL配置 [英] Correct MySQL configuration for Ruby on Rails Database.yml file

查看:158
本文介绍了正确的Ruby on Rails Database.yml文件的MySQL配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有此配置:

development:
  adapter: mysql2
  encoding: utf8
  database: my_db_name
  username: root
  password: my_password
  host: mysql://127.0.0.1:3306

我收到此错误:

Unknown MySQL server host 'mysql://127.0.0.1:3306' (1)

有明显的错误提示吗?

Is there something obvious that I am doing incorrectly?

推荐答案

您应将主机与端口号分开. 您可能会有类似的内容,

You should separate the host from the port number. You could have something, like:

development:
  adapter: mysql2
  encoding: utf8
  database: my_db_name
  username: root
  password: my_password
  host: 127.0.0.1
  port: 3306

这篇关于正确的Ruby on Rails Database.yml文件的MySQL配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆