Saturday, July 17, 2010

Setting up MySQL with Ruby on Rails in Windows

1. Download MySQL Community Server (latest is 5.1.48) and install it.
2. In the console type
gem install mysql
This installs the mysql adapter for ruby.
With rails 2.2 or later (mine is 2.3.8),  MySQL 5.1 in windows doesn't integrates well.
3. So to avoid problems download libmySQL.dll. This is an older version of MySQL client library. Copy it into the ruby\bin folder.
This avoids error during rake db:migrate which might cause
rake aborted!
Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
4. You can install the MySQL GUI Toolkit (optional).