There are two modules for connecting to a MySQL database server from Ruby:
- MySQL/Ruby is built on top of the MySQL C API, and provides the same functions for Ruby programs that the MySQL C API provides for C programs.
- Ruby/MySQL is written in pure Ruby, and implements (mostly) the same interface as MySQL/Ruby. (This module is also included in the Ruby on Rails distribution.)
MySQL/Ruby and Ruby/MySQL are both written and maintained by Tomita "tommy" Masahiro.
Ruby DBI is a database-independent API for Ruby that uses the above modules to work with MySQL.
You can install MySQL/Ruby using the Ruby Gems packaging manager:
$ sudo gem install mysql