Monday, January 21, 2008

Mysql driver for rails



When installing the mysql gem you might get this:

Building native extensions.  This could take a while... ERROR:  Error installing mysql: ERROR: Failed to build gem native extension.

the fix is easy but you are going to need the mysql-devel package if you are on redhat then do this:

yum install mysql-devel

Now you can install the mysql driver like this:

gem install mysql -- --with-mysql-config=`which mysql_config`

To test the driver us the rails console:

# ruby script/console
>> require ‘mysql’
>> puts Mysql::VERSION

This should give you the 20700 version. (As of Jan 2007 thats the latest version.)Now enjoy the speed.

No comments: