The Inevitable MySQL Gem Install

Got your new box all set up? Let's do some Rails:

$ rake db:create
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please 
install the mysql gem and try again: gem install mysql.

rake aborted!
no such file to load -- mysql

If you're on Ubuntu, do this:

$ sudo apt-get install libmysqlclient15-dev 
$ which mysql_config
/usr/bin/mysql_config

$ sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

If you're running on OSX and have installed mysql from MacPorts, mysql_config is already installed:

$ sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5

Done.