问题描述
我创建了一个新的rails项目调用
rails new simple_cms
pre>
然后当我在目录中运行
rails s
我收到以下错误
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l
ib / mysql2 / mysql2.rb :2:在`require'中:MySQL客户端库版本不正确!这个
gem是为6.0.0编译而客户端库是5.5.24。 (RuntimeError)
来自C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32 / lib / mysql2 / mysql2.rb :2:在`< top(required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32 / lib / mysql2.rb:9:在`require'
从C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-
x86-mingw32 / lib / mysql2.rb:9:在`< top(required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems /bundler-1.1.3/
lib / bundler / runtime.rb:68:在`require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems /bundler-1.1.3/
lib / bundler / runtime.rb:68:在`block(2 levels)in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems /1.9.1/gems/bundler-1.1.3/
lib / bundler / runtime.rb:66:在each
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems /1.9.1/gems/bundler-1.1.3/
lib / bundler / runtime.rb:66:在`block in require'
from C:/ Rai lsInstaller / Ruby1.9.3 / lib / ruby / gems / 1.9.1 / gems / bundler-1.1.3 /
lib / bundler / runtime.rb:55:在`each'
from C:/ RailsInstaller / Ruby1.9.3 / lib / ruby / gems / 1.9.1 / gems / bundler-1.1.3 /
lib / bundler / runtime.rb:55:在`require'
from C: RailsInstaller / Ruby1.9.3 / lib / ruby / gems / 1.9.1 / gems / bundler-1.1.3 /
lib / bundler.rb:119:在`require'
from c:/ development / ruby / simple_cms / config / application.rb:7:在`< top(re
quired)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9。 1 / gems / railties-3.2.3
/lib/rails/commands.rb:53:in`require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9。 1 / gems / railties-3.2.3
/lib/rails/commands.rb:53:in`block in< top(required)>'
from C:/RailsInstaller/Ruby1.9.3 /lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:50:in从C:/RailsInstaller/Ruby1.9.3中点击
/lib/ruby/gems/1.9.1/gems/railties-3.2.3
/lib/rails/commands.rb:50:in`< top(required)&g t;'
从脚本/ rails:6:在`require'
从脚本/ rails:6:在`< main>'
我看到其他人有这个错误,但他们往往是linux用户,我正在运行Windows。我尝试重新安装rails(railsinstaller.org)和mysql 5.5。我使用了32位版本以及64位版本
解决方案这里已经有了几个问题。你试过他们的解决方案吗?
可能最清楚的是:
相关部分在这里: / p>
在构建此宝石时,必要的DLL文件可用
在以下下载中:
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
将lib\libmysql.dll文件放在您的Ruby bin目录中,例如
C:\Ruby\bin
I created a new rails project calling
rails new simple_cms
Then when in the directory I run
rails s
I get the follow errors
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l ib/mysql2/mysql2.rb:2:in `require': Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 5.5.24. (RuntimeError) from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11- x86-mingw32/lib/mysql2.rb:9:in `<top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler/runtime.rb:68:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler/runtime.rb:68:in `block (2 levels) in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler/runtime.rb:66:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler/runtime.rb:66:in `block in require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler/runtime.rb:55:in `each' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler/runtime.rb:55:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/ lib/bundler.rb:119:in `require' from c:/development/ruby/simple_cms/config/application.rb:7:in `<top (re quired)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 /lib/rails/commands.rb:53:in `require' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 /lib/rails/commands.rb:53:in `block in <top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 /lib/rails/commands.rb:50:in `tap' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.3 /lib/rails/commands.rb:50:in `<top (required)>' from script/rails:6:in `require' from script/rails:6:in `<main>'
I have seen other people with this error but they tend to be linux users and I am running windows. I have attempted to reinstall both rails (railsinstaller.org) and mysql 5.5. I have used both the 32bit version as well as the 64bit version
解决方案There seem to be several questions on here already about this. Did you try their solutions?
Probably the most clear is this:mysql2 gem compiled for wrong mysql client library
The pertinent part is here:
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
这篇关于MySQL客户端库版本不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!