Sharing ideas

Solving problems

Gathering solutions

Exchanging thoughts

Ruby On Rails



Debian & Ubuntu
jQuery & CSS

How to Deal With MySQL Error 2013

Some time ago I was having problem with my script that backups all the databases on the server – one day it just began to produce empty sql files. When I ran script manually I saw unpleasant:

Error 2013: Lost connection to MySQL server

while dumping one of the tables – hence empty backups.

First I tried to check table, repair it and optimize it, but with no luck. So I took a look at syslog (I guess should have done that first) and saw to my surprise:

InnoDB: Database page corruption on disk (...)

I will spare you the googling and give you solution that might help you too. After reading this reference I decided to set value of


to 1 (in /etc/my.cnf), restart server, quickly dump the problematic table (with this option on database is locked so if you’re doing in on production server maybe prepare some bash scripts first), revert changes in config and restart mysql once again.

After that I dropped that table and without any problems imported it again – since then everything works smooth.