rake db:create generated“如果你手动设置字符集,请确保你有匹配的排序规则”错误

我在版本2.3.8中获得了一个rails项目。 当我试图运行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) 

我手动创建了DB并尝试运行该应用程序。 现在我收到了这个错误。

 /!\ FAILSAFE /!\ Tue May 10 20:38:48 +0530 2011 Status: 500 Internal Server Error uninitialized constant MysqlCompat::MysqlRes 

我尝试了Webrick和mongrel,这似乎是同样的原因。

啊,这个错误很常见。 它的MySQL。 这是解决方案 。 根据需要更改路径。 让我们知道您的身体情况如何。 祝一切顺利。

 export ARCHFLAGS="-arch i386 -arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local \ --with-mysql-config=/usr/local/bin/mysql_config 

我遇到了同样的错误。 在我的例子中,问题是我没有创建在database.yml中指定的MySQL用户。

 mysql --user=root mysql grant all privileges on *.* to 'user_name_here'@'localhost' identified by 'password_here'; exit;