# Intermitent 'lost connection to mysql' error

**URL:** <https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503>\
**Category:** Rails\
**Created:** [June 5, 2006, 5:42pm UTC](https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503 "2006-06-05T17:42:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Shoemaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@Jeremy\_Shoemaker](https://www.ruby-forum.com/u/Jeremy_Shoemaker)\
**Post date:** [June 5, 2006, 5:42pm UTC](https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503/1 "2006-06-05T17:42:18Z")

</div>

Hi,  
I’ve been looking at Ruby on Rails for an in-house project where I  
work. After I got everything setup correctly (apache, fcgi, mysql, etc)  
I’ve started to run into “lost connection to mysql” errors. I googled  
to try and find a solution, but most of the problems people seem to be  
having are constant and simple to fix. I haven’t found anyone talking  
about intermitent problems. Most of the time, the queries go through  
without a hitch, and then suddenly, I get the error page saying it lost  
connection.  
If anyone can help, I’d appreciate it. I can post the exact error  
message if need be, but I wasn’t gonna send them if I don’t have to.  
For the record, we’re using:  
Apache 2.0.58  
MySql 4.1.14  
Ruby 1.8.4  
Rails 1.1.2

Thanks,  
Jeremy Shoemaker

---

<div class="post-metadata">

**Author:** ![Jeremy\_Shoemaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@Jeremy\_Shoemaker](https://www.ruby-forum.com/u/Jeremy_Shoemaker)\
**Post date:** [June 5, 2006, 5:52pm UTC](https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503/2 "2006-06-05T17:52:37Z")

</div>

Greetings Jeremy,

I’d start searching on the wiki,

for instance: [http://wiki.rubyonrails.org/rails/pages/Mysql+Connection](http://wiki.rubyonrails.org/rails/pages/Mysql+Connection)  
+Problems

Plus you’ll find os specific solutions on the ‘pages’ page.

I get the feeling you’re on windows? If so, I’ve found the following  
to be necessary to achieve stability.

[http://www.vandomburg.net/pages/mysql-ruby-windows](http://www.vandomburg.net/pages/mysql-ruby-windows)

Jodi

---

<div class="post-metadata">

**Author:** ![Jeremy\_Shoemaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@Jeremy\_Shoemaker](https://www.ruby-forum.com/u/Jeremy_Shoemaker)\
**Post date:** [June 5, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503/3 "2006-06-05T18:56:28Z")

</div>

Actually, its not running on Windows. I knew I forgot to mention  
something. Its running on Solaris 9. Also, I tried most of the stuff  
on that first page. I think I might know what the problem is though.  
I’ll post again if I get any results.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Shoemaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@Jeremy\_Shoemaker](https://www.ruby-forum.com/u/Jeremy_Shoemaker)\
**Post date:** [June 5, 2006, 11:37pm UTC](https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503/4 "2006-06-05T23:37:14Z")

</div>

Ok, I noticed I don’t actually have mysql-ruby installed. But I’m  
having issues getting it to install, either from ruby gems or from  
source. And what really makes no sense is the fact that for all intents  
and purposes, it works without it. I can get it to serve pages from the  
application, but after about the 10th request, it dies with the “lost  
connection” message. And if you try again, it usually works fine.

Anyone else ever have anything like this going on?

---

<div class="post-metadata">

**Author:** ![Jeremy\_Shoemaker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ebca7d/32.png) [@Jeremy\_Shoemaker](https://www.ruby-forum.com/u/Jeremy_Shoemaker)\
**Post date:** [June 9, 2006, 3:24pm UTC](https://www.ruby-forum.com/t/intermitent-lost-connection-to-mysql-error/62503/5 "2006-06-09T15:24:27Z")

</div>

Jeremy Shoemaker wrote:

> Ok, I noticed I don’t actually have mysql-ruby installed. But I’m  
> having issues getting it to install, either from ruby gems or from  
> source. And what really makes no sense is the fact that for all intents  
> and purposes, it works without it. I can get it to serve pages from the  
> application, but after about the 10th request, it dies with the “lost  
> connection” message. And if you try again, it usually works fine.

Rails includes its own copy of a patched version of the pure ruby MySQL  
driver, to fall back on if no other MySQL driver is installed.

That one is obviously not working reliably for you; I can only suggest  
that you keep trying to get a non-Rails driver installed.

regards

Justin
