mysql gem installation on Windows x64

Having run into multiple issues setting up MySQL with Rails on Windows x64 my recommendations are:

  • Install the 32-bit version of MySQL, do not try to use the 64-bit version.
  • Install into a path with no spaces, do not accept a default like "C:\Program Files\MySQL\MySQL Server 5.5\"
  • Install the MySQL gem with an invocation similar to:
         gem install mysql -- --platform=ruby --with-mysql-dir="D:\Programs\MySQL\MySQL-Server-5.5" --with-libmysqllib="D:\Programs\MySQL\MySQL-Server-5.5\lib\"
  • Be sure to uninstall/reinstall whenever you install a new version of MySQL.
  • Make sure D:\Programs\MySQL\MySQL-Server-5.5\lib is included in your path, as well as D:\Programs\MySQL\MySQL-Server-5.5\bin. Make sure other copies of libmysql.dll are not being picked up from elsewhere on your path or your ruby installation directories.

Unfortunately with mysql-5.5.15-win32, mysql-2.8.1-x86-mingw32 and Windows 7 x64 even this was not enough: after experiencing a segmentation fault running rake db:create I gave up and downloaded the libMySql.ddl from InstantRails.