Invalid MySQL Client Library Version

I created a new rails project calling

rails new simple_cms 

Then when in the directory I run

 rails s 

I get the following 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 are usually linux users and I run windows. I tried reinstalling both rails (railsinstaller.org) and mysql 5.5. I used both the 32-bit version and the 64-bit version

+6
source share
3 answers

Here, it seems, there are already a few questions about this. Have you tried your solutions?

Probably the clearest: mysql2 gem compiled for the wrong mysql client library

The relevant 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 
+13
source

This will remove the gem and its dependencies. Then reinstallation will recompile itself and all the dependencies.

 gem uninstall mysql2 bundle install 
+4
source

I had this error in a new project that I was working on, and suddenly stopped working on a Windows machine that already had working rails, so there was clearly no problem.

As a result, there was a problem with the bundle update command, which decided to restart gem mysql2 (for unknown reasons) and ignored my gemfile gem 'mysql2', '~> 0.2.6' .

The problem was that the package update received mysql version 0.2.18, as shown in Gemfile.lock, in the following line:

  mysql2 (0.2.18-x86-mingw32) 

I'm sure the character means, but I replaced the following line in my gemfile

 gem 'mysql2', '~> 0.2.6' 

for

 gem 'mysql2', '0.2.6' 

And now everything is working fine, including bundle update .

0
source

Source: https://habr.com/ru/post/916483/


All Articles