Port Rails 3.2.12 fix for MySQL weirdness.

Should fix #219