简体   繁体   中英

Can't start WEBRick web server - Ruby is throwing MySQL errors

I'm a Windows 8.1 user with a 64-bit machine. However, I've installed everything regarding Ruby in 32-bit versions to prevent those famous errors all around the internet. This didn't suffice... I'm still receiving a weird error when trying to start Rails's WEBBrick server which mentions MySQL:

C:\Users\User\Workspace\Ruby\ruby_learn>rails server
C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:in `require':
Incorrect MySQL client library version! This gem was compiled for 6.1.3 but the
client library is 6.0.0. (RuntimeError)
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2.rb:8:i
n `<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:76:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:76:in `block (2 levels) in require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:72:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:72:in `block in require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:61:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler/runti
me.rb:61:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.5.3/lib/bundler.rb:13
1:in `require'
        from C:/Users/User/Workspace/Ruby/ruby_learn/config/application.rb:7:in
`<top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:76:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:76:in `block in <top (required)>'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:73:in `tap'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/comman
ds.rb:73:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

I indeed had some trouble to get MySQL work the other day, but I solved it by doing some stuff I didn't understand with MySQL C Connector 6.0.2 , then earlier I couldn't get the bundle to install because it was asking for mysql2 0.3.15 , but I had mysql2 0.3.13 apparently. I'm not sure where it wrong. So the updated C Connector which I got from dev.mysql.com fixed the bundle issue, but now the web server wont run.

I didn't know that setting Ruby on Rails up could be such a pain, but I'm still very motivated about it and I need help in order to continue.

Thanks.

Try and see if this answer helps you mysql2 gem compiled for wrong mysql client library :

There's a helpful message that is shown when you gem install mysql2. Unfortunately, if you install the gem with Bundler, Bundler eats the message

I hope this solves your problem..

Incorrect MySQL client library version

I went through the same problem and Installed Mysql client library from here

http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

download And put lib\\libmysql.dll file in your Ruby bin directory, for example C:\\Ruby\\bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM