mysql2 gem 为错误的 mysql 客户端库编译

标签 mysql ruby-on-rails windows mysql2

当尝试通过我的 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/

相关文章:

mysql - 列依赖于其他列值

mysql - 谁在mysql中工作AES_DECRYPT?

ruby-on-rails - 尝试使用 React 在 Rails 应用程序上设置 ruby​​ 时出现 yarn 问题

ruby-on-rails - Rails路由发送带点和int的字符串

ruby-on-rails - 如何在元标记 og :description content in ruby on rails 中使用 html_safe

windows - Stack Overflow 答案中 2>nul 的用途是什么?

php - 在 phpmyadmin mysql 中声明游标和存储过程

php - 如何在phpmyadmin中合并相似表

windows - 如何保护 SQLite 数据库?

c++ - 在不放弃关闭按钮或系统菜单的情况下从 Windows 标题栏中删除图标?