MySQL driver for Rails in Windows 7 x64

17,574

Solution 1

My colleague had a similar problem while running rails on Windows 7. He had to replace the libmySQL.dll (in the PATH) with the one from InstantRails.

Solution 2

I spent hours trying to get MySQL and Rails to play nicely on Windows (albeit XP, both 32 and 64-bit versions). I finally gave up since my production box was running Linux (on which Rails and MySQL play very nicely) and just used SQLite 3 for development. No headaches to get it working and it runs fast enough for development purposes.

However, I did hear of some people that had luck replacing one of the DLLs provided by the gem with one provided by the official MySQL distribution. Also, some people simply didn't have this DLL at all which was causing problems. In the end, it didn't work for me, but hopefully you will have more luck.

Solution 3

For Rails or DataMapper or whatever to talk to MySQL you need a 32-bit driver in Rails\bin. The driver is called libmysql.dll. Even if you have a 64-bit server you need a 32-bit driver.

64-bit driver will fail will ruby/gems/1.8/gems/do_mysql-0.10.2-x86-mingw32/lib/do_mysql/1.8/do_mysql.so: 193: %1 is not a valid Win32 application.

A wrong 32-bit version will crash with memory allocation error or something weird like that (suggested solution to take libmysql.dll from another project may not work with newer versions of MySQL).

Solution 4

I am new to this rails. I just have passed the same issue in vista. after downloading libmySQL.dll (in the PATH) with the one from InstantRails it starts working.

[email protected]

Solution 5

The solution to this problem is to simply install the 32-bit version of mysql.

Share:
17,574
Jakub Arnold
Author by

Jakub Arnold

Experienced software engineer with a background in machine learning and computer science and over 7 years of commercial practice of software development, looking to work on production quality software.

Updated on June 20, 2022

Comments

  • Jakub Arnold
    Jakub Arnold almost 2 years

    I've got problem with connecting to MySQL database on my freshly installed Windows 7 machine. I'm getting this error when I try to migrate my database.

    !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install 
    the mysql gem and try again: gem install mysql.
    rake aborted!
    193: %1 is not valid Win32 application - C:/Ruby/lib/ruby/gems/1.8/gems/mysql-2.8.1-x86-mswin32/lib/1.8/mysql_api.so
    

    I currently have installed

    ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
    mysql version 5.0.86  for Win64
    gem 1.3.1
    mysql-2.8.1-x86-mswin32