This screencast will show you how to use a Ruby script to connect to a MySQL database. I use Ruby version 1.8.7 and the mysql gem version 2.8.1.

Using a Ruby script to Connect to MySQL Database