Running MySQL and RubyOnRails on Windows

rails.jpgIf you’re trying to get RubyOnRails connected to MySQL on Windows Vista as we have done recently at Vamosa, then keep in mind that the current latest versions of MySQL and the MySQL gem are incompatible with each other.

At the time of writing, the current versions of MySQL is 5.1 and the MySQL gem is currently at version 2.7.3.

We were unable to get this combination to work together and ended up reverting to MySQL 5.0 and MySQL gem 2.7.1.

gem install -v "2.7.1" mysql

I don’t think you’re missing anything substantial from either MySQL 5.1 or the 2.7.3 gem.



3 Responses to “Running MySQL and RubyOnRails on Windows”

  1. Hi Ijonas

    Are you running x86 or x64 development machines? I have been having issues as described in this post and have tried your solution.

    I am now getting the following error which I believe is to do with it trying to install x86 drivers on x64.

    —————————————–

    C:\Users\david.lawton\Desktop\outerbound_poc\trunk\source\outerbound>gem install -v “2.7.1″ mysql
    Successfully installed mysql-2.7.1-x86-mswin32
    1 gem installed
    Installing ri documentation for mysql-2.7.1-x86-mswin32…
    Installing RDoc documentation for mysql-2.7.1-x86-mswin32…
    ERROR: While generating documentation for mysql-2.7.1-x86-mswin32
    … MESSAGE: Unhandled special: Special: type=17, text=”"
    … RDOC args: –op C:/Ruby/lib/ruby/gems/1.8/doc/mysql-2.7.1-x86-mswin32/rdoc -
    -exclude ext –main README –quiet ext README docs/README.html
    (continuing with the rest of the installation)

    —————————————–

    I then fire up WebRick and get:

    —————————————–

    LoadError in Rails/infoController#properties

    193: %1 is not a valid Win32 application. – C:/Ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so

    RAILS_ROOT: C:/Users/david.lawton/Desktop/outerbound_poc/trunk/source/outerbound

    This error occurred while loading the following files:
    mysql

    —————————————–

    Did you run into any of these issues?

    Cheers

    Dave the Ninja

  2. ijonas says:

    I’m pretty sure the guys are running x86 (and not x64) versions of Vista, so you may have an issue there. The other thing I’ve noticed is that the stacktrace when you’re running your app mentions a v2.7.3 gem

    193: %1 is not a valid Win32 application. - C:/Ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so

    I would try uninstalling the whole Ruby stack (leave MySQL installed) and make sure there’s no trace of mysql gems.

  3. Hi Ijonas,

    Further investigations and “hacking” about has revealed that its not the OS that’s the issue.

    RoR does not support MySQL x64

    I installed x86 and it ran first time.

    Keep them RoR posts coming! Looking forward to the next one, as this one already saved me hours of pain!

    Dave the Ninja

Leave a Reply