Ruby MySQL adapter on Windows
It is very easy to install Ruby MySQL adapter using gem on Windows.
gem install mysql
But I found Ruby MySQL adapter does not work with MySQL 5.1 on my Windows box. When Ruby executed SQLs or Rails server got requests, I got some errors like this
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/ connection_adapters/abstract_adapter.rb:39: [BUG] Segmentation fault ruby 1.8.6 (2009-08-04) [i386-mingw32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
It seems the reason is that this version of mysql gem does not work with MySQL 5.1 lib. I saw some suggestions on Web to downgrade MySQL to 5.0 to solve the problem. However, I don’t want to downgrade MySQL. It turns out the solution is very simple. Download MySQL 5.0 noinstall version mysql-noinstall-5.0.89-win32.zip from http://dev.mysql.com/downloads/mysql/5.0.html. Extract libmysql.dll and copy it to C:\Ruby\bin. Then, the problem is solved. I am still running MySQL 5.1. But Ruby uses this MySQL 5.0 version dll.
My environment: Ruby 1.8.6. Gem 1.3.5. MySQL gem version 2.8.1. Rails version is 2.3.5. Windows XP and MySQL 5.1.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
Thanks a million, buddy ! After hours of frustration you gave me the solution that I needed. This worked like a charm. And by the way, I love your blog too. Keep up the good work !
I took up learning Ruby yesterday as a personal hobby. I would have probably given up without your blog to help me out.
Thanks man…. a lost a good with this!!!
Valeu mesmo!! Abraço!!
You’re a hero