# Lost Connection to MySQL

**URL:** <https://www.ruby-forum.com/t/lost-connection-to-mysql/95807>\
**Category:** Rails\
**Created:** [June 14, 2006, 6:46am UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807 "2006-06-14T06:46:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 14, 2006, 6:46am UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/1 "2006-06-14T06:46:01Z")

</div>

Error Message: MyMysql::Error: Lost connection to MySQL server during  
query:  
SHOW FIELDS FROM products

Running Fedora 5, using available Red Hat modules and latest version of  
Rails.

This problem just appeared. I had been enjoying going through the  
tutorial “Depot”  
when it started displaying this problem. With phpMyAdmin I am able to  
access the  
depot\_development data base containing entries that I had used the depot  
application to display, enter, and edit with no problems earlier. The  
only  
application that still works is the non data base application “Hello  
from Rail”  
The dump follows.

Hope someone can help.

ActiveRecord::StatementInvalid in AdminController#index

Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS  
FROM products

|RAILS\_ROOT: script/…/config/…|

Application Trace [http://192.168.1.102:3000/admin#](http://192.168.1.102:3000/admin#) | Framework Trace  
[http://192.168.1.102:3000/admin#](http://192.168.1.102:3000/admin#) | Full Trace  
[http://192.168.1.102:3000/admin#](http://192.168.1.102:3000/admin#)

|/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/connection\_adapters/abstract\_adapter.rb:120:in `log' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:in `execute’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:293:in  
`columns' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:in `columns’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/calculations.rb:213:in  
`column_for' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:135:in `calculate’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/calculations.rb:64:in  
`count' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:172:in `count\_collection\_for\_pagination’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action\_controller/pagination.rb:196:in  
`paginator_and_collection_for' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:in `paginate’  
#{RAILS\_ROOT}/app/controllers/admin\_controller.rb:8:in `list' #{RAILS_ROOT}/app/controllers/admin_controller.rb:3:in `index’|

---

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 14, 2006, 9:06pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/2 "2006-06-14T21:06:24Z")

</div>

> application to display, enter, and edit with no problems earlier. The only  
> application that still works is the non data base application “Hello from  
> Rail” The dump follows.
> 
> Hope someone can help.

This might help…

[http://dev.mysql.com/doc/refman/5.0/en/gone-away.html](http://dev.mysql.com/doc/refman/5.0/en/gone-away.html)

-philip

---

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 15, 2006, 6:23am UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/3 "2006-06-15T06:23:27Z")

</div>

Thanks for the response.

Because I am not experiencing the same problem with other DB  
applications I have discounted, possibly mistakenly, MySQL. However I  
will check the possibilities in the link you sent.

---

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 15, 2006, 7:41pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/4 "2006-06-15T19:41:52Z")

</div>

Philip H. wrote:

> > had used the depot application to display, enter, and edit with no
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)  
> Thanks again. However, even though the link gave me more places to  
> look, I still haven’t found out anything useful.

I did try to build the scaffold from scratch by reloading the data-base  
depot\_development then trying to redo the application. I got as far as:

ruby script/generate scaffold Product Admin and got the error:  
“Before updating scaffolding from a new DB schema, try creating a table  
for your model (Product)”

Using phpMyAdmin, I verified that depot\_development existed, contained  
the table, products, and I was able to access the data.

---

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 17, 2006, 4:54pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/5 "2006-06-17T16:54:26Z")

</div>

Felix Bearden wrote:

> > > to access the depot\_development data base containing entries that I  
> > > -philip
> 
> >

As per the suggestions in this link, I extended the time and made  
applicable changes with no positive results.

A problem was at some time introduced to the system. As much as I hate  
to, I am re-installing Fedora 5. It is about a three day effort for me  
to get everything back from the backuped data files.

---

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 15, 2006, 8:59pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/6 "2006-06-15T20:59:24Z")

</div>

Did you do…

‘gem install mysql’ ?

---

<div class="post-metadata">

**Author:** ![Felix\_Bearden](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/a5b964/32.png) [@Felix\_Bearden](https://www.ruby-forum.com/u/Felix_Bearden)\
**Post date:** [June 17, 2006, 5:00pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql/95807/7 "2006-06-17T17:00:34Z")

</div>

Thanks,

I understood that this was not necessary, or, at first I installed it  
with no problems. I now get install errors. It appears that I am  
missing some headers. (I need to keep better notes)

I am having other problems with my server, and as much as I hate to do  
it, I am reinstalling it on a freshly formatted disk.

Will report on results after I finish.

Felix
