Ruby on Rails
HowToUseMySQLRubyBindingsOnWin32

As it seems no one has managed to compile the latest version of mysql-ruby to work on windows (at least no one is sharing libraries that I could find), and I couldn’t stand it not working (Mostly the latter). I decided to give it a try.

I finally got the bitch working on WinXP (I think..). I compiled against both mysql server version 4.1.15 and 5.0.15. (I currently only use (and briefly tested) the former, as the latter gives problems with older aps)

Anyway, the result is at http://jeroen.concept-q.biz/files/

I’d appreciate feedback if it works for you too, as I’m sure others would like to know whether or not these libraries are useful to them (I haven’t done extensive testing so I cannot claim it works). If it doesn’t work I’m sorry to say my C knowledge has already been stretched to its limits and I’m rather clueless on how to solve any problems.

Apparently a real programmer (at-least more real than me) took over the job of providing ruby with a decent mysql-ruby win32 dll. As I’m not planning to update my stuff I’ve updated this first post and will now link to (hopefully) actively maintained solutions: http://www.vandomburg.net/pages/mysql-ruby-windows. You could also take a look at http://rubyforge.org/projects/mysql-win


This is the answer to the Hellish lost connection with mysql and ruby problem. As far as I can tell it’s a problem with Instant Rails using ruby-mysql-2.6 instead of 2.7.

Jeroen’s mysql.so file works but his version of msvcr70.dll is dodgey. But you can download that off t’internet for nothing, just google for it.

At last a stable Rails development environment on Windows XP and 2000.


The 5.0.15 driver seems to be working perfectly.



I have a problem using mysql on win with NAMED PIPES - nobody seems to use mysql with named pipes on windows… with rails I can not even use a generator or anything else to connect to mysql via named pipe – could anybody using rails on windows please check out WHAT people will have to do to get it working on windows with mysql over named pipes? THANKS!

Thanks! This was a perfect solution to the mysql woes that started when I upgraded to Rails 1.0 on Windows XP.
I’m including the log error that plagued me so this page gets indexed by the search engine, and will lead others to this solution.
ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL server during query: ... )Tal Rotbart

I had the same issue with upgrading to Rails 1.0 – MySQL lost the connection. What it doesn’t say is you have to put the mysql.so file found above into ..ruby path>\1.8\i386-mswin32\ directory.

This did the trick for me… thought I was going mad for a while… mysql.so into \1.8\i386-mswin32\ and msvcr70.dll in \bin… – Jeff McNeill

Guys i don’t get it. I am new to rails, new to developing web applications in fact, and while I can get it to work by itself I cant get it to talk to mysql 5. Every time I try to generate a scaffold I get an error “Before updating scaffold from new DB schema…” I just know as soon as I fix that problem there will be another one.Now you guts have probably already solved all these long back, but I’m still stuck and I cant find any solutions on the web. Can you tell me what I need to do to get up and running so we can all party? I use win XP.
Thanks.

I have just had the “Before updating scaffold…” error but in my case it was because I was asking Rails to use a table called “user” and my table was called “user”- it expects a pluralisation, so it wants the table to be called “users”.

You can Turn this behaviour off.



I’m maintaining a MySQL/Ruby for Windows distribution much like Jeroen’s over at http://www.vandomburg.net/pages/mysql-ruby-windows

This distribution doesn’t require an external msvcr.dll and will be actively maintained.

- Roderick van Domburg


This is another solution
I found a completely different solution at HowTosWorkerThreads



If Webrick is very unstable (crashes with a segmentation fault randomly) it is most likely because you need a better version of mysql.so. I found the solution here, check it out:
http://aspn.activestate.com/ASPN/Mail/Message/ruby-rails/3018279

Yet another solution
http://rubyforge.org/projects/mysql-win


Despairing on 2000 I have RoR working with MySQL absolutely fine on my XP laptop at home, but I’ve spent half a day today trying to get a stable configuration on the 2000 desktop I have at work with no success. I’ve tried all the mysql.so variants (I’ve even tried deleting the file altogether) above as well as the libmysql.dll from 4.1 and 5.0 installs of MySQL. Each one allows one or two data-driven pages to be viewed before the http server segfaults. That goes for WEBrick and Mongrel.

Having to restart the server after every other page view is not agile.


I was getting the segfaults. To fix, I had to reinstall DBI and MySql gem. Details: I removed all mysql gems. This included looking into the gem directory where I found an old version of mysql lerking. Then I removed DBI and DBD from ruby’s lib\ruby\site_ruby\1.8. After that, I got the latest DBI from http://ruby-dbi.rubyforge.org/ and followed the instructions to install it. I only included setting up the dbd_odbc and dbd_msyl. (I use odbc for sql server connections). After that I installed the latest mysql gem. Now it runs without segfaults. I think there was something wrong with the version of DBI that shipped with the windows one-click installer.