Ruby on Rails and mysql connection problems
If you are losing connection to mysql every so often on OSX (I'm using 10.5 Leopard), it's probably because you do not have the native C ruby-mysql bindings. If your error looks like this:
Mysql::Error: Lost connection to MySQL server during query:
then try the following. Verify that the bindings are really not present. In a terminal window, open up the interactive ruby shell and type the following commands:
irb
>> require 'mysql.bundle'
=> true
>> exit
If you do not get 'true', then you need the bindings. Back to your terminal window and type the following:
$ sudo -s
$ ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql
Try require 'mysql.bundle' again and this time you should get back true.
Sources: 1 and 2.