You are here

MySQL will not start due to corrupt InnoDB tables

Submitted by Druss on Mon, 2013-01-28 22:47

After a recent server migration, I found that my MySQL instance was not starting up (on Debian Squeeze). A look in the logs revealed that MySQL was having issues with corrupt InnoDB tables and therefore refusing to start. A number of forums informed me to do the following.

  1. Open (in my case) /etc/mysql/my.cnf in an editor.
  2. Add the following line within the [mysqld] section (which should also have a comment noting it as the Basic Settings section.
    innodb_force_recovery = 1
  3. Save the file and exit the editor.
  4. Restart MySQL.
  5. Use mysqldump to take a complete database dump.
  6. Comment out the innodb_force_recovery switch in my.cnf (by prefixing the line with a #.
  7. Save the file again.
  8. Restart MySQL.

This, according to the forum, should fix the corruption error. Apparently, simply dumping the jury-rigged database is enough to clean it up. This, however, did not happen in my case.

I did however get mine back up and running with:
innodb_force_recovery = 4

Unfortunately, dumping the database after this did not fix my tables. I apparently need to delete the InnoDB databases, and the data and log files, and subsequently restore my databases from backups. I will tackle this in a different post once I get it working. FWIW, the error message I'm seeing in the logs hints at something like the following:

Innodb log sequence number is in the future.