When try to connect to the mysql server through my rails application, I get the following error
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)
How can I rectify it?
I had the same problem , and I have solved the follows:
1 :: Download the zip the following link: https://dev.mysql.com/downloads/connector/c/
2 :: decompress the file ( libmysql.dll ) in the " Provider" folder of project.
3 :: Volve one to run the command
bundle install
and ready , solved !
https://dev.mysql.com/downloads/connector/c/
in my case on windows, incorrectly copied libmysql.dll from MySQL Server 5.5 directory to ruby200/bin. correct is to copy libmysql.dll from mysql-connector-c-noinstall-6.0.2-win32.
Uninstalling and reinstalling the gem will often solve this issue with no need to download and move files around by hand. From your rails app directory:
I had the same problem as you, or at least the symptom was the same.
Background: I was using Rails 3, the mysql2 gem, and MySQL community server version 5.5.21 (32-bit) installed locally on my Windows machine. I grabbed the client library (
libmysql.dll
) from the MySQL installation and copied it to my ruby installation'sbin
folder.When I ran
bundle exec rake db:create
, I got the same error message as you and I thought "Hey, how can the client library be outdated when I got it from the latest MySQL release?"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. Here it is:Following these instructions solved the problem for me.
Referenced link
If you are using 64bit version of mysql and 32bit version of ruby, then check this solution on http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/
You basically have to download a single connector from mysql website, and compile mysql or mysql2 with connector you downloaded.
for Ruby 1.9.2:
for Ruby 1.9.3: (showing mysql2 variant)
Note the use of forward slashes for the directory where MySQL Connector/C was extracted.
I had an issue just like this:
The issue for me was that I had both versions, 5.5.29 and 5.6.17, installed on my machine. I have no idea how. When I bundled it automatically chose the 5.5.29 version. I uninstalled that one and then reinstalled my gem and that fixed the issue.