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

sha*_*jin 7 mysql database rake ruby-on-rails

我在版本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)
Run Code Online (Sandbox Code Playgroud)

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

/!\ FAILSAFE /!\  Tue May 10 20:38:48 +0530 2011  
  Status: 500 Internal Server Error  
  uninitialized constant MysqlCompat::MysqlRes  
Run Code Online (Sandbox Code Playgroud)

我试过Webrick和mongrel这两个问题似乎都是同样的原因.

Cha*_*rdy 4

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

export ARCHFLAGS="-arch i386 -arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local \ --with-mysql-config=/usr/local/bin/mysql_config
Run Code Online (Sandbox Code Playgroud)