Innodb force recovery help

February 5, 2016 647 views
MySQL WordPress DigitalOcean

I think that my mySQL database is corrupt, and after consultation with Digital Ocean the help guy has advised me to run an innodbforcerecovery. They have sent me over a link to a document that explains the process, however I am at a loss as to how to run the command via the Digital Ocean console. Do I need to be in a specific folder 1st, run another command before hand, etc?

Any help will be appreciated.

(please note that I did not set up this droplet, i've inherited it when the previous person left. I only have the root user password, and the database password in the wordrpress php file)

1 Answer

Fixing InnoDB tablespace corruption, or otherr such sever InnoDB issues are quite tricky. You can mess up a lot doing this if you don't know what you're doing. Because of how complicated the process can be, it requires a lot of MySQL knowledge.

If you are going to attempt it, I would suggest doing the following before hand:

  1. Making a complete snapshot of your droplet
  2. Starting MySQL in recovery mode, making MySQL dumps of all the databases,
  3. Checking the dump files (make sure all info and data is there)
  4. Deleting the corrupted databases, then try remaking them using the dumps
  5. Restarting MySQL

If that does not work, then you would want to try doing a Force Recovery via InnoDB. To do this, place the following line in the /etc/my.cnf file:


After that, restart your MySQL service and let InnoDB try to recover itself. If it fails, change the value from the above code snippet to 3, then try restarting MySQL once more. If that fails, try changing it to 4 then trying once more. If that still fails, you will want to reach out to a MySQL expert, as anything beyond level 4 can do pretty severe damage to your data and droplet.

An alternative that may be easier for you is to use a third party repair tool. I cannot personally vouch for them, but a highly recommend on is Stellar Phoenix.

Please keep in mind everything above is very tricky to do. As such, make sure you have a snapshot made. Worse case scenario, you can revert and try to start from the beginning.

Hope it helps,
Jason C.
DigitalOcean Platform Support Lead

Have another answer? Share your knowledge.