Forum: Ruby on Rails Mysql::Error: Lost connection to MySQL server during query

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
brad (Guest)
on 2006-01-12 22:37
I have been very VERY frustrated for the past week trying to solve a
seemingly spurious problem with my Windows XP SP2 box with Ruby
1.8.2/Rails 1.0.0/MySQL 5.0.16 or 4.1.15 (yes, I tried both) installed
running against a remote MySQL server that was either 3.23 or 4.1
(4.1.15 to be exact--we finally matched them both up to make sure that
wasn't the problem).

So I post it here (as well as in the Rails_Engine forum, where it first
arose for me), in the hopes that it will save someone else some
significant trouble.

Just for the record, in case others have this problem, what I did was
download a compresssed .RAR file for mysql 4.1.15 (mysql-ruby-win32.rar)
and copied the file to the location specified in the readme at
this link:

This did the trick...  I've spent more than 3 days pulling my hair out
(as well as my business partner who's also lost some hair as well--plus
he hates it when I pull his hair  ;-), but didn't discover this link
until just now.  Thanks Colin!! (original source:
thread # 29. Which, unfortunately, I can't post to, in order to help
others who may have this same problem.)

EVERYONE: If you are getting ANY kind of MySQL::Error, in particular
what I was getting was variations of this:

Mysql::Error: Lost connection to MySQL server during query [ . . . ]

(Buried deep in a stack trace from Rails--this wasn't occuring for a
local instance of MySQL server, but only when it was running on a remote
server--in our case on a 1&1 dedicated--I think Fedora--host that we
self-manage.  Of course the adapter worked fine from the server itself
AND it worked fine from a Mac OS X box running the identical
Ruby/Rails/login_engine code against this remote MySQL server, but
always got the error above when running from my Windows XP SP 2 box.)

Anyway, if you have this problem, try going to the above URL and
download the .RAR file there (you may need to download WinACE or
something similar to read .rar compressed files), then read the
readme.txt located within and copy the file where it directs.

Good luck!

~ Brad
Tom F. (Guest)
on 2006-01-12 22:54
(Received via mailing list)
There is a bug with WEBrick that will cause MySQL errors to be

The ticket contains the problem, and the fix:

Since this bug is timing related, changing drivers, running on a
platform, or running MySQL over the net could also cause it to appear or

If you're not running WEBrick, you won't see the problem in the ticket.
This topic is locked and can not be replied to.