Tag Archives: mysql

The Rails Grim Reaper

After upgrading to Rails4, I started to see this error ActiveRecord::StatementInvalid: Mysql2::Error: Lost connection to MySQL server during query: in my logs. It seemed random in some places (normal, but generally larger than average queries), and less random in others (high failure rate in long running queries, e.g. in workers). It turns out, I had   …Continue Reading

Mysql::ProtocolError with ruby-mysql

Was getting a “Mysql::ProtocolError” when running the ruby-mysql gem with the 64bit version of MySQL on Mac OS X 10.6. Stackoverflow said to downgrade the version (done – modified the Gemfile to specify the exact version), but I still had to modify one line of code to get it to work. The line of code   …Continue Reading

MySQL Foreign Key Constraints & Cascade Delete

I’ve never actually used a foreign key constraint with cascading delete in a production environment, least not that I can remember. But for GPS Log this is very useful, to enforce key constraints, and also make deleting users extremely easy!  Just 1 delete statement on the UserId and the DB takes care of the rest.   …Continue Reading