I can't use the mysql ruby gem because I get this error:

Incorrect MySQL client library version! This gem was compiled for 5.6.15 but the client library is 5.5.34. (RuntimeError)

apt-get is installing libmysqlclient-dev-5.5

$ sudo apt-get install libmysqlclient-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 41 not upgraded.
Need to get 1,397 kB of archives.
After this operation, 5,629 kB of additional disk space will be used.
Get:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu/ precise-updates/main libmysqlclient-dev amd64 5.5.34-0ubuntu0.12.04.1 [1,397 kB]
Fetched 1,397 kB in 0s (11.8 MB/s)           
Selecting previously unselected package libmysqlclient-dev.
(Reading database ... 63296 files and directories currently installed.)
Unpacking libmysqlclient-dev (from .../libmysqlclient-dev_5.5.34-0ubuntu0.12.04.1_amd64.deb) ...
Processing triggers for man-db ...
Setting up libmysqlclient-dev (5.5.34-0ubuntu0.12.04.1) ...

How do I install version 5.6 of libmysqlclient-dev?

I'm using Ubuntu 12.04.


If you want the official way , you must upgrade to 12.10 or higher.

But the indirect way is Percona Server with XtraDB providing libmysqlclient-dev 5.6 version. So if you ADD their PPA then it will give you a way to install libmysqlclient-dev 5.6.

To add it , do this in your terminal

gpg --keyserver  hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A
gpg -a --export CD2EFD2A | apt-key add -
sudo sh -c 'echo "deb http://repo.percona.com/apt precise main" >> /etc/apt/sources.list.d/percona.list'

Then sudo apt-get update

then try again.


I had the same problem on Ubuntu 14.04 Trusty. Disclaimer: I'm not an expert on this, but this is what I did to get it installed.

I think the library needed is libperconaserverclient18.1-dev.

Having installed this, the mysql2 gem installation got further, but I got the following error: ERROR: Failed to build gem native extension. In the logs I saw:

/usr/bin/ld: cannot find -lssl
/usr/bin/ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
make: *** [mysql2.so] Error 1

The fix to this was to install libssl-dev. I also found that I had 2 unexpected / unwanted packages installed, mysql-common and libmysqlclient18. This is because percona-server-server-5.6 depends on libdbd-mysql-perl, which depends on libmysqlclient18. This is documented in percona server bug 1407889. This causes some out of date config in my.cnf, but it's not a showstopper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.