How do I install mysql2 gem with percona 5.6 on Ubuntu 14.04 Trusty?

I’ve setup percona-server-server and percona-server-client packages as per the instructions on the percona website, but when I try to install the mysql gem, I see the following message:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

Looking in the logs I see:

checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no

I tried installing libmysqlclient-dev, but this installs the 5.5 version, and I see this error:

Incorrect MySQL client library version! This gem was compiled for 5.5.41 but the client library is 5.6.23-72.1.

How do I install this properly?

Answer

Instead of libmysqlclient-dev, install libperconaserverclient18.1-dev and libssl-dev packages.

More info in this Ask Ubuntu answer.

Attribution
Source : Link , Question Author : robd , Answer Author : Community

Leave a Comment