我和您有相同的问题,或者至少症状是相同的。
背景:我正在使用Windows计算机本地安装的Rails 3,mysql2 gem和MySQL社区服务器版本5.5.21(32位)。我libmysql.dll从MySQL安装中获取了客户端库(),并将其复制到了ruby安装的bin文件夹中。
当我运行时bundle exec rake db:create,我得到了与您相同的错误消息,并且我想:“嘿,当我从最新的MySQL版本中获得客户端库时,该客户端库怎么过时了?”
当您显示一条有用的消息gem install mysql2。不幸的是,如果您在Bundler上安装宝石,Bundler会收到消息。这里是:
=========================================================================
You've installed the binary version of mysql2. It was built using MySQL
Connector/C version 6.0.2. It's recommended to use the exact same version
to avoid potential issues.
At the time of building this gem, the necessary DLL files where available
in the following download:
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
And put lib\libmysql.dll file in your Ruby bin directory, for example
C:\Ruby\bin
遵循这些说明可以为我解决问题。