# MySQL connection problems on Dreamhost

**URL:** <https://www.ruby-forum.com/t/mysql-connection-problems-on-dreamhost/59187>\
**Category:** Rails\
**Created:** [April 30, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/mysql-connection-problems-on-dreamhost/59187 "2006-04-30T23:25:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [April 30, 2006, 11:25pm UTC](https://www.ruby-forum.com/t/mysql-connection-problems-on-dreamhost/59187/1 "2006-04-30T23:25:50Z")

</div>

To all fellow Dreamhosters out there…

Sometimes my app mysteriously loses its connection to the database,  
resulting in a big ugly “Application Error (Rails)” page. Usually  
refreshing the page makes it go away, but not today. ☹

In production.log I see this:

MysqlError (Lost connection to MySQL server during query):

Any idea why this happens? It’s rather intermittent and random, but I  
get this a few times a week.

I’ve pasted a large section of the call stack below in case it helps.

Thanks!  
Jeff

```
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:316:in 

```

`real_connect' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:316:in`connect’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:87:in  
`initialize' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/mysql_adapter.rb:37:in`new’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:37:in  
`mysql_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in`send’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:145:in  
`connection_without_query_cache=' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_cache.rb:54:in`connection=’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:106:in  
`retrieve_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in`connection’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:734:in  
`columns' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:746:in`column\_names’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:759:in  
`column_methods_hash' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:in`all\_attributes\_exists?’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:1016:in  
`all?' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:in`each’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:1016:in  
`all?' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1016:in`all\_attributes\_exists?’  
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active\_record/base.rb:975:in  
`method_missing' /app/models/trivia_question.rb:6:in`for\_today’

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [May 1, 2006, 1:20am UTC](https://www.ruby-forum.com/t/mysql-connection-problems-on-dreamhost/59187/2 "2006-05-01T01:20:53Z")

</div>

I have been running a Rails app on Dreamhost for a couple of weeks now  
(just launched official beta Sat) and I have not yet run into any issues  
like this. If I do notice them I will let you know, though.

Frank

> **[劳士顿\_劳士顿手表\_劳士顿手表官网-劳士顿手表官方旗舰店](http://www.lobbr.com)**
>
> 劳士顿(ROSDN),中国腕表品牌新星,属深圳市艾诺表业有限公司旗下全资核心品牌,由深谙中国制表业起伏的艾诺掌门人——罗立清于2005年创立.劳士顿(ROSDN)品牌系列腕表.

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [May 3, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/mysql-connection-problems-on-dreamhost/59187/3 "2006-05-03T18:56:51Z")

</div>

On Apr 30, 2006, at 2:25 PM, Jeff C. wrote:

> Any idea why this happens? It’s rather intermittent and random, but I  
> get this a few times a week.

You might ask your hosting provider. Their database might be  
restarting and causing your connection to disappear.

…or perhaps your application is attempting to run queries that are  
above their memory allocation limits and it kills the query during  
the process of fetching data.

Good luck tracking down the solution.

Cheers,

Robby

Robby R.  
Founder & Executive Director

PLANET ARGON, LLC  
Ruby on Rails Development, Consulting & Hosting

> **[Planet Argon](https://www.planetargon.com)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[www.robbyonrails.com](http://www.robbyonrails.com)

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4968 [fax]

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [May 3, 2006, 6:56pm UTC](https://www.ruby-forum.com/t/mysql-connection-problems-on-dreamhost/59187/4 "2006-05-03T18:56:58Z")

</div>

i’ve talked to dreamhost a couple of times about this. it happens on  
occasion, which is really annoying. all the static pages come up  
fine, but mysql connections die. they told me it’s because another  
account on the same server is hogging all the bandwidth and that  
mysql is the first to die in that situation.

i would just email them about it. they always replied to me within a  
day.

good luck.

-tak.
