简体   繁体   中英

Installing ruby mysql gem with percona server

New install of cent os 5.4; clean install of percona xtradb server (Server version: 5.1.56-rel12.7 Percona Server (GPL), 12.7, Revision 224) gem install mysql failed with the output

/usr/local/rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... yes
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** extconf.rb failed ***

which appears to indicate it can't find the dev libraries. I know I'd normally use the additional options -- --with-mysql-lib=... but I don't believe they're installed as part of the normal percona install outlined here: percona repositories info

So I tried doing yum install mysql-devel but get a conflict with the percona stuff. I found this post where the proposed solution was using the --with-mysql-config option. Percona doesn't automatically install a my.cnf at /etc/my.cnf upon installation, so I whipped one up and placed it there because that's where the init.d script for mysql checks for it. Restarted mysql, confirmed that it's now loading that configuration and attempted the install again, but still failed with

"Exec format error - /etc/my.cnf --cflags (Errno::ENOEXEC)"

Thanks for any help

I also did a find / -name mysql.h and nothing, so it looks like the required libraries are not present after installing both percona server and client with yum

If you correctly added Percona yum repository you just need to install the Percona-Server-devel package:

yum install Percona-Server-devel-55

Replace 55 with the Percona Server version you're currently using.

After that, mysql gems will install correctly.

After troubling hours and hours and many hours:

Found the following to install mysql gem with percona 5.6:

http://www.percona.com/doc/percona-server/5.6/release-notes/Percona-Server-5.6.16-64.1.html

gem uninstall mysql

apt-get remove mysql-server mysql-server-5.5 mysql-client mysql-client-5.5 mysql-client-core-5.5 mysql-server-core-5.5 mysql-common libmysqlclient18:i386 libmysqlclient18:amd64

apt-get install percona-server-server-5.6 percona-server-client-5.6

cd /usr/lib/x86_64-linux-gnu

mv libmysqlclient.so.18.0.0 libmysqlclient.so.18.0.0-backup

ln -s libperconaserverclient.so.18.1.0 libmysqlclient.so.18.0.0

rm -rf /home/slat/.rvm/gems/ruby-XXXXX/gems/mysql*

gem install mysql

YIHAA - It works!

对于任何尝试安装此gem的新人(此问题在搜索排名中显示得非常高),请确保您传递的是mysql目录,例如:

 gem install mysql2 -- --with-mysql-dir=/usr/local/mysql

I've reinstalled libmysqlclient-dev from Percona.

And then reinstalled mysql & mysql2 gems.

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