Ruby Development

MySQL bindings with Ruby 1.9

I’ve started messing around with Rails 2.3.1 (aka RC2) and seeing how it works with Ruby 1.9. Aside from having to install all my gems for the new version of Ruby, the mysql bindings needed to be installed too. Here’s how I got it working:

Note: I’m using macports installations of ruby 1.9 and mysql

# Grab mysql-ruby

wget http://rubyforge.org/frs/download.php/51087/mysql-ruby-2.8.1.tar.gz

# Setup to use your mysql configuration files

ruby1.9 extconf.rb \
  --with-mysql-include=/opt/local/include/mysql5/mysql/ \
  --with-mysql-lib=/opt/local/lib/mysql5/mysql/ \
  --with-mysql-config=/opt/local/bin/mysql_config5

sudo make

# Run tests to make sure everything passes
ruby1.9 ./test.rb -- localhost

# And to finish it out
sudo make install