当尝试通过我的 Rails 应用程序连接到 mysql 服务器时,我收到以下错误
D:/Program_Files/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require':
Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.0.27. (RuntimeError)
我该如何纠正它?
最佳答案
卸载并重新安装 gem 通常可以解决这个问题,而无需手动下载和移动文件。从您的 rails 应用程序目录:
> gem uninstall mysql2
You have requested to uninstall the gem:
mysql2-0.3.11
database_cleaner-0.9.1 depends on [mysql2 (>= 0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] Y
Successfully uninstalled mysql2-0.3.11
> bundle install
Fetching gem metadata from http://rubygems.org/......
Fetching gem metadata from http://rubygems.org/..
Using rake (0.9.2)
Using i18n (0.6.1)
... <SNIP> ...
Installing mysql2 (0.3.11) with native extensions
... <SNIP> ...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
关于mysql2 gem 为错误的 mysql 客户端库编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8740868/