当我运行rails服务器时,它会显示如下错误消息:
`require': Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.1.42. (RuntimeError)
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql-2.9.1-x86-mingw32/lib/mysql.rb:4:in `<top (required)>'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from C:/Rails/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
我安装了Mysql 5.1数据库。
在我的宝石文件中,我写了这个:
gem 'mysql'
然后运行bundle install
导致此问题的原因是什么?
答案 0 :(得分:2)
试试这个
添加Gemfile
gem 'mysql2'
然后执行bundle install,并在命令行运行此命令以安装这些软件包。
sudo apt-get install mysql-client libmysqlclient-dev
在Windows上
将libmysql.dll从mysql安装文件夹复制到Ruby bin 系统上的目录。
答案 1 :(得分:0)
我认为你应该尝试包含mysql2 gem,在你的gemfile中添加:
gem 'mysql2'