我正在尝试在我的某个rails应用中执行rake db:create
。我收到的错误是
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>false, "database"=>"new-db", "pool"=>5, "username"=>"root", "password"=>"password"}, {:charset=>"utf8", :collation=>"utf8_unicode_ci"}
(If you set the charset manually, make sure you have a matching collation)
这就是我database.yml
的样子
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: new-db
pool: 5
username: root
password: password
我尝试在上面的代码中添加host:localhost
,它没有用。
此外,当我尝试使用mysql -u root -password
登录mysql时,我正在
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
有人可以帮忙吗。
答案 0 :(得分:-1)
在除第一行EX之外的每一行之前添加制表符空格。以下
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: new-db
pool: 5
username: root
password: password