Beginner's question: Rails 3 and MySQL on Windows

I’ve failed to get Rails 3 to connect to MySQL and have read that
the current MySQL ( which is MySQL2) doesn’t work with Rails 3. It
isn’t clear to me, from looking at the primarily *nix instructions on
the net, how to do this in Windows: settings in database.yml, gems to
install, where to get a MySQL database that works and where to put it,
etc. What are the proper steps?

Easiest way to get started with Rails on Windows is to use
RailsInstaller -

MySQL 5.1 has issues with Rails on windows, so better use MySQL 5.0,
installing either choose the option where mysql exe is added to path or
libmysql.dll after installation to ruby’s bin folder.

If this doesn’t work, then post the exact error you encounter and we
take it from there.

I have a post John Ivanoff: Ruby 1.9.2 Rails 3, A Clean Install on Windows XP where I did a clean install for
rails 3 any MySQL. I am also using MySQL 5.1 on Win XP
It is a pain to get it going on windows but once you do it run OK.
Also on my blog I’ve posted a few gotcha’s I’ve had with windows and
some gems.

Hope it helps.


Hi Guys,
Thanks for the replies, but I’m still stuck with “rake
db:migrate” failing. I get a popup window that says that LIBMYSQL.DLL
can’t be found and the command line says that c:/ruby192/lib/ruby/gems/
ruby 1.9.1/gems/mysql-2.8.1-x86-mingw32/lib/1.9/ can’t be
found (the statement has the Windows slashes backward but I don’t know
where that request is coming from in the code and I suspect that it
doesn’t matter, anyway). Using the parameter “–trace” shows a lot of
lines but none of them are marked as creating the error. I’ve
installed MySQL 5.5.13 today from the community site but I
have no evidence that that is being used.
Any suggestions on what is stopping this progress would really be

example yml setting

adapter: mysql
encoding: utf8
reconnect: false
database: name_of_database
pool: 5
username: agoodone
password: secret
socket: /tmp/mysql.sock

I’ve always used mysql Gem

gem install mysql


Sorry, left out a step from the above:

 Get a dll:
and put it in c:\ruby192\bin with other dlls

That’s before, of course, running: rake db:migrate in the ruby
command line shell


Well, to use a former co-workers phrase, “I’ve been crawling over
broken glass”, trying everything and seemed to have found something
that worked: 1) I downloaded and installed MySQL community edition
5.5.13, even though it isn’t on anyone’s recommended list and 2)
installed a gem for mysql-2.8.1-x86-mingw32 which I saw recommended
somewhere, then 3) modified John’s yml file from above to be:

adapter: mysql
encoding: Latin1
reconnect: false
database: mysql
pool: 5
timeout: 5000
username: a
password: a

and the line: rake db:migrate finally worked and made a table with
the data I had in that file. Also, I could add a couple of records
via the screen from http://localhost:3000/people
so I think I can make progress from here. Thanks to John and Chirag
for taking the time to point me in some good directions!

On Jun 30, 2:54pm, Barney [email protected] wrote:

have no evidence that that is being used.
You need libmysql.dll from MySQL 5.0.x, which was used to build mysql
gem binaries.

Either you download that or you can force compilation of MySQL gem
following these instructions (see MySQL/C Connector)

Luis L.