Rails w/ MySQL (Windows 7-64)

mysql, programming, rails

Mainly notes on setting up the following (suitable for Dreamhost’s Rails setup):

  • Ruby 1.8.7-p374
  • Rails 3.0.3
  • Ruby devkit  (from http://rubyinstaller.org/downloads/)
  • MySQL Installer 5.6.17 Community Server 64-bit
  • mysql2 GEM ‘0.2.22’

Install Ruby 1.8.7 by going to: http://rubyinstaller.org/downloads/

Install Rails 3.0.3 by: gem install rails -v 3.0.3

Latest MySQL: http://dev.mysql.com/downloads/mysql/

mysql2 GEM:

  1. Get mysql-connector-c-6.1.3-win32.zip from http://dev.mysql.com/downloads/connector/c/. Unzip to C:devtools (or wherever).
  2. Run: gem install mysql2 -v '0.2.22' -- --with-mysql-dir="c:devtoolsmysql-connector-c-6.1.3-win32"  (Use whatever path you unzipped the connector above.)

Go to the Rails app and modify the GemFile:

...
gem 'mysql2', '0.2.22'
...

Run: bundle install

Copy c:devtoolsmysql-connector-c-6.1.3-win32liblibmysql.dll to %RUBY_HOME%bin

 

Leave a Reply