LIBMYSQL.dll was not found 2

Posted by mike on June 23, 2008

I recently upgraded my laptop to 4 Gigs of RAM and needed to upgrade Windows to the 64 bit version in order to utilize it. After installing everything and getting it all setup, I needed to do some work on an existing Rails application.  I pull it out of my Subversion repository, create the dev and test databases, and run ‘rake db:migrate’ only to get this message:

MySQL_Error

I’m pretty confident that MySQL is installed correctly and I have the databases and permissions setup correctly.  A quick Google search tells me that others have experienced the same issue and they were able to resolve it by finding the dll and copying it to the ruby/bin directory. So…

copy "C:\Program Files\MySQL\MySQL Server 5.0\bin\libmySQL.dll" C:\ruby\bin\

OK, fire up rake again and I get the same error. Back to Google again and after a bit more digging I find that there is an issue with Ruby support in the 64 bit version of MySQL. So I head back to the MySQL website and download the 32 bit zip version without the installer. Open it, navigate to the bin directory and copy libmysql.dll to the ruby/bin directory. This has taken care of the issue and I haven’t had any problems working with the 64 bit version of MySQL using the 32 bit library in Ruby.