[英]rake db:create generated “if you set the charset manually, make sure you have a matching collation” error
I got a rails project in version 2.3.8. 我在版本2.3.8中获得了一个rails项目。 When i tried to run rake db:create, the below error occured. 当我试图运行rake db:create时,发生以下错误。
Couldn't create database for {"encoding"=>"utf8", "username"=>"root", "adapter"=>"mysql", "database"=>"claims_test", "host"=>"localhost", "password"=>"root", "socket"=>"/var/run/mysqld/mysqld.sock"}, charset: utf8, collation: utf8_unicode_ci
(if you set the charset manually, make sure you have a matching collation)
And I created DB manually and tried to run the application. 我手动创建了DB并尝试运行该应用程序。 And now I am getting this error. 现在我收到了这个错误。
/!\ FAILSAFE /!\ Tue May 10 20:38:48 +0530 2011
Status: 500 Internal Server Error
uninitialized constant MysqlCompat::MysqlRes
I tried with both Webrick and mongrel and it seems like same cause for both issue. 我试过Webrick和mongrel这两个问题似乎都是同样的原因。
Ah, this error is so common. 啊,这个错误很常见。 Its MySQL. 它的MySQL。 Here is the solution . 这是解决方案 。 Change paths as required. 根据需要更改路径。 Let us know how you get on. 让我们知道您的身体情况如何。 All the best. 祝一切顺利。
export ARCHFLAGS="-arch i386 -arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local \ --with-mysql-config=/usr/local/bin/mysql_config
I ran into the same error. 我遇到了同样的错误。 In my case, the problem was that I hadn't created the MySQL user who was specified in database.yml
. 在我的例子中,问题是我没有创建在database.yml
中指定的MySQL用户。
mysql --user=root mysql
grant all privileges on *.* to 'user_name_here'@'localhost' identified by 'password_here';
exit;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.