# Need ideas for MySQL Lost connection Errors

**URL:** <https://www.ruby-forum.com/t/need-ideas-for-mysql-lost-connection-errors/130514>\
**Category:** Rails\
**Created:** [February 28, 2008, 10:39pm UTC](https://www.ruby-forum.com/t/need-ideas-for-mysql-lost-connection-errors/130514 "2008-02-28T22:39:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 28, 2008, 10:39pm UTC](https://www.ruby-forum.com/t/need-ideas-for-mysql-lost-connection-errors/130514/1 "2008-02-28T22:39:26Z")

</div>

Read through many of the prior messages (most from mid 2006), and I  
don’t see any that apply to my setup.

I’m experiencing an intermittent appearance of  
“Mysql::Error: Lost connection to MySQL server during query”

The usual blames I saw were change from MySQL 4.0 to 4.1 so password  
type mistmatch, old version of a mysql gem, tabs in database.yml. None  
of these apply.

As I say, intermittent. Several requests are just fine, then I get a  
Proxy Error message. go look in the production.log, and see the  
Mysql::Error entry.

fresh install of OS X 10.5.2 on box “app01” we’ll call it.

fresh install of OS X 10.5.2 on box “data01” we’ll call it.

using built-in MySQL on “data01” for now (5.0.45).

installed a Rails app on “app01” with a frozen 1.2.3 in /vendor.

database.yml defines the connection using “host:” with an IP address and  
a password.

the password in MySQL is verified to be a new style password.

both machines are new intel Xserves, just now being set up so they’re  
not busy at all.

Looking for new ideas…

Thanks,  
– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 28, 2008, 10:43pm UTC](https://www.ruby-forum.com/t/need-ideas-for-mysql-lost-connection-errors/130514/2 "2008-02-28T22:43:19Z")

</div>

> As I say, intermittent. Several requests are just fine, then I get a  
> Proxy Error message. go look in the production.log, and see the  
> Mysql::Error entry.

Sorry, not a “proxy error” – just the standard 500 ISE

– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 29, 2008, 4:24am UTC](https://www.ruby-forum.com/t/need-ideas-for-mysql-lost-connection-errors/130514/3 "2008-02-29T04:24:47Z")

</div>

Try this in your environmnet.rb files:

ActiveRecord::Base.verification\_timeout = 14400

Also make sure you have the mysql gem installed

gem install mysql – --with-mysql-dir=/usr/local/mysql

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [February 29, 2008, 5:34am UTC](https://www.ruby-forum.com/t/need-ideas-for-mysql-lost-connection-errors/130514/4 "2008-02-29T05:34:33Z")

</div>

heimdull wrote:

> Try this in your environmnet.rb files:  
> ActiveRecord::Base.verification\_timeout = 14400

Read up on that. Doesn’t seem to be the problem. When I say  
intermittent, I mean a handful of back to back queries work fine, then  
one doesn’t. The time frame of these numbers doesn’t seem to be relevant  
to what I am seeing.

Still, I did it of course. Changed the value, restarted mongrel cluster.  
Loaded a page, whacked reload, and got the same error.

> Also make sure you have the mysql gem installed  
> gem install mysql – --with-mysql-dir=/usr/local/mysql

yep – all that stuff is loaded (built-in versions, so different  
location, but it’s all there)

– gw
