skip down to the 3 comments

Installing MySQL gem on CentOS

Old news, but you’d be surprised how many times the same:

Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.

error brings everything to a halt. Well on Centos the way to install the MySQL gem is:

$ sudo yum install mysql mysql-devel gcc
# 32 bit machine
$ sudo gem install mysql -- \
> --with-mysql-include=/usr/bin/mysql \
> --with-mysql-lib=/usr/lib/mysql
# or 64 bit like they are on SliceHost
$ sudo gem install mysql -- \
> --with-mysql-include=/usr/bin/mysql \
> --with-mysql-lib=/usr/lib64/mysq
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

There have been 3 responses to this post.

  1. bill

    On 64 bit centOS machines you are gonna want this:

    gem install mysql — –with-mysql-conf=/usr/bin/mysql –with-mysql-lib=/usr/lib64/mysql

  2. Duncan

    Thanks Bill, I’ve added both now

  3. Javidan

    Thanks man, you saved my life

back to the top