Be prepared to Rails 2.2 – how to install mysql gem on Ubuntu

November 25th, 2008 by sergey Leave a reply »

Rails 2.2 is already out, and this release should be an exciting leap torwards multithreading, i18n etc. I definitely will give it a try. Today I’m using 2.1.2, and each time I run ‘rake test:units’ I get distracted a bit by a message that tells me that internal Rails’ MySQL adapter already deprecated. So I decided to get rid of it.

>sudo aptitude install mysql

Doesn’t work! It says some libraries are missing. And since build-essential I’ve already installed

>sudo aptitude install build-essential

I jumped into Google. I’ve found that some development version of libmysqlclient library is the cure. Both

>sudo aptitude install libmysqlclient5-dev

and

>sudo aptitude install libmysqlclient12-dev

are failed. So, how to find out the actual version number?

> sudo aptitude search mysqlclient | grep dev

It would print out something like this:

v libmysqlclient-dev -
i libmysqlclient15-dev – MySQL database development files

So it turns out that there is a meta-package(libmysqlclient-dev), and performing following command

>sudo aptitude install libmysqldev

would care about right version automatically. Now the time to install mysql gem has came:

>sudo gem install mysql

And finally, if you brave enough, do the last move:

>sudo gem update rails

Advertisement

Leave a Reply

You must be logged in to post a comment.