RSS feed

Gem mysql2 fix when installing Rails 3.0 and Ruby 1.9.2 on Windows 7

September 27, 2010

If you are trying to install Rails 3 on Windows 7, you might have run into a few problems.  Now, I’m a total Rails n00b, but I’ll share my fix for getting the server to run without barking.  Until the mysql2 gem is updated to work on Windows 7, you can use the older mysql gem in these simple steps:

  1. Install Rails 3.0 under Ruby 1.9.2 (be sure you already have MySQL installed, or else Google installation instructions and make it happen)
  2. Update your gems and make sure to install mysql.
  3. Create a Rails project and open your Gemfile.
  4. Comment out gem mysql2 like this:
    #gem 'mysql2'
    and add
    gem 'mysql'
  5. Now copy the file libmysql.dll (mine was in C:\wamp\bin\mysql\mysql5.1.36\bin) to your Ruby bin directory (should be C:\Ruby192\bin)
  6. You should be good to go.  Try running
    rails server
    from your app directory.

Works for me!  Hopefully, us unfortunate Windows users will be able to use the newer mysql2 gem soon.

Contact Me

sean@seanmccambridge.com

Twitter: @mccambridge

LinkedIn profile

A LOT OF PEOPLE HAVE ASKED about the background photo on this site. It was taken on the beach by Fort Moultrie on the harbor side of Sullivan's Island, SC. The old, wooden sea wall has been there as long as I've lived in Charleston. The beach is a great place to watch the ships and shrimpers come in and has one of the best views of downtown Charleston.