When attempting to do a Ruby on RailsĀ rake db:migrate on Mac OS X, you receive the following error message:

rake aborted!
uninitialized constant MysqlCompat::MysqlRes


Steven Hamton over at TechLiberty came up with the solution for this one:

sudo gem uninstall mysql

Prior to Leopard:
sudo gem install mysql — –with-mysql-dir=/usr/local/mysql
Leopard on a PPC machine:
sudo env ARCHFLAGS=”-arch ppc” gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
Leopard on an Intel machine:
sudo env ARCHFLAGS=”-arch i386″ gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
Snow Leopard (only on Intel):
sudo env ARCHFLAGS=”-arch x86_64″ gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config