views:

143

answers:

2

On occasion, my local Rails app loses its connection to MySQL. I get some error that the connection failed, but if I just refresh the page, it works fine. This has never happpened in my STAGE or PROD environments (I deploy to Ubuntu), so it has not been that big a deal.
Does this happen to anybody else? Is there something I can do to fix it? Is it MySQL or Ruby?

+3  A: 

Look like the best solution to this is to install the platform specific mysql driver.
sudo gem install mysql

Matt Brown
+1  A: 

I remember having this problem a while back (before i upgraded to Leopard?). They're tricky to diagnose, but have a look at logfiles, and try setting "wait_timeout" longer (you shouldn't have to mess with "max_connections". See:

http://www.mysqlperformanceblog.com/2008/08/23/how-to-track-down-the-source-of-aborted_connects/

http://dev.mysql.com/doc/refman/5.0/en/communication-errors.html

http://www.softwareprojects.com/resources/programming/t-how-to-fix-mysql-database-myisam-innodb-1634.html

I think i followed Dan Benjamin's MySql install blog to not have problems:

http://hivelogic.com/articles/installing-mysql-on-mac-os-x/

Gene T