Wednesday, August 24, 2011

Running Rails 3.x with mysql2 on Windows

Every time I have to set up Ruby & Rails with MySQL on windows its the same old drag.

The easy part goes like this:
Installing Ruby 1.9: download ruby installer
Installing gem:  follow gem installation instructions
Install MYSQL: I like using the WAMP server, but its also possible to go for the MySQL regular installation
and:
Install Rails 3.x: run gem install rails

But then you will need to:
Install mysql2 by running gem install mysql2 -v 0.2.6
and
Copy libmySQL.dll from mysql bin to ruby-home/bin
This is downloadable from http://www.mysql.com/downloads/connector/c/

Now generate and run your server.
Don't forget to configure your database.yml file

Note: that if when sunning the server, it responds like:
Could not find gem 'mysql2 (~> 0.2.11)' in any of the gem sources listed in your Gemfile
Then go into your server root directory and open up the Gemfile
substitute the line:
gem 'mysql2', '~> 0.2.11'
with
gem 'mysql2', '~> 0.2.6'

...And your good to go.








No comments:

Post a Comment

Please do not post spam on this blog, Spam sites will be reported to google.
thank you kindly.