Compiling the Native MySQL Ruby Gem on Debian

I just realized that my production servers were running the Ruby version of the MySQL driver, to the tune of a performance penalty of 10-15%, according to Riding Rails.



It turns out the compilation had failed because it couldn’t locate the include files and library files, which get strewn around the file system in Debian when MySQL in installed using “apt”.



After trying various things, it turns out this worked:



sudo gem install mysql -- --with-mysql-config


Don’t ask me why, it just worked for me. I’d suppose that compiling your own Mysql and installing it /usr/local would work as well, if you use thi—with-mysql-dir option instead.

2 comments

Jos Hartman
 

Magic !! I had troubles to install mysql on Host Europe which is some SuSE distro and this worked !!!!
Read more
Read less
  Cancel
Olle Jonsson
 

My trouble was solved (without having to give any options to gem install) when I installed the "library header files":http://packages.ubuntulinux.org/dapper/libdevel/libmysqlclient15-dev as well. D'oh! Thanks for bringing this up.
Read more
Read less
  Cancel

Leave a comment