Friday, January 11, 2013

MySQL Error 2013

I encountered 2013 during mysqldump and when selecting from a specific table.

A good tip I found was to check Uptime after the query

mysql> \s
Uptime: 7 min 4 sec

Which indicated the mysqld instance had restarted.

The best solution was for me was to check /var/log/mysql/mysql-error.log . It turned out advice from the log file saved the day:

InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.

After rebooting the OS the error was gone.

Other advice I found online was:

1. Check wait_timeout is long enough

mysql> show variables

The default is 28800 seconds (8 hours). This was set to the default and thus not the problem.

2. Set max_allowed_packet to something larger

I opted for one gigabyte

mysql> set max_allowed_packet=1000 * 1024 * 1024;

This also had no effect. It would have been better if I had checked the error log immediately which makes good sense after an unexpected restart.

No comments: