[英]Setting up my rails app to MySQL Database
I am having trouble connecting my rails app to MySQL. 我在将Rails应用程序连接到MySQL时遇到问题。 I am using SQL Pro as my GUI.
我使用SQL Pro作为我的GUI。
Heres my database.yml 这是我的数据库.yml
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: ecommerce-app-development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: ecommerce-app-test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: ecommerce-app-production
pool: 5
username: root
password:
socket: /tmp/mysql.sock
I tried creating a database called 'ecommerece-app-developent' in SQL Pro, but heres the error message it gives me: 我尝试在SQL Pro中创建一个名为“ ecommerece-app-developent”的数据库,但以下是它给我的错误消息:
Connected to host, but unable to connect to database ecommerce-app-development. 已连接到主机,但无法连接到数据库ecommerce-app-development。
Be sure that the database exists and that you have the necessary privileges. 确保数据库存在并且您具有必要的特权。
MySQL said: Unknown database 'ecommerce-app-development' MySQL说:未知数据库“电子商务应用程序开发”
You need to create the database before connecting to it. 连接数据库之前,需要先创建数据库。
rake db:create
will do this for you, then you can connect to it using SQL Pro or whatever. rake db:create
将为您完成此操作,然后您可以使用SQL Pro或任何其他方式连接到它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.