Lock wait timeout fix
This page may be outdated or contain incorrect details. Please update it if you can.
If there are complaints about lock wait timeout errors and/or being unable to save a page for many hours, do this:
- connect to the database server and use show processlist. Look for queries which are in status sleep and have a long run time (thousands of seconds). Use the kill threadid command to end those processes.
- The default time for MySQL to wait for a web server is 8 hours (28800 seconds). You can interactively change this to 15 minutes with set global wait_timeout=900 (requires root) and update /etc/my.cnf with set-variable = wait_timeout=900. Shared hosting places may prefer a shorter time, in the one to five minute range.
This is believed to be caused by PHP getting into an infinite loop or otherwise hanging with a connection open.