I ran into this crap when I needed to purge a massive number of records from a database. All you need to do is edit the timeout setting in your MySQL config file.

On my Mac it is located at : /etc/my.cnf

Uncomment the line:

innodb_lock_wait_timeout = 50

And change the setting to 500 (its seconds)

Restart mysql and rerun your query.


sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist

If you make this change on a production server you may want to set it back to the default setting. I don’t know what the consequences of a long timeout setting would be.

If you're running the Homebrew mysql package, you might have to create `/etc/my.cnf` -- there are a few examples in `/usr/local/Cellar/mysql/5.1.53/share/mysql` but I don't think they're used until you copy one to `/etc/my.cnf`