InnoDB crashed

Sometimes, our databases got corrupted and innoDB crashed in the server. Due to this, MySQL service won't restart and following message:

Starting MySQL..The server quit without updating PID file (/var/lib/mysql/my.server.com.pid).[FAILED] or MySQL server PID file could not be found!

In such situation, you will have to start MySQL with InnoDB in force recovery mode using the following steps:

Step 1. Stop MySQL service

Step 2. Backup /var/lib/mysql directory

Step 3. Add the following line into /etc/my.cnf: innodb_force_recovery = 4

Step 4: Restart MySQL. Your database will now start, but with innodb_force_recovery, all INSERTs and UPDATEs will be ignored.

Step 5: Dump all tables

Step 6: Shutdown database and delete the data directory. Run mysql_install_db to create MySQL default tables

Step 7: Remove the innodb_force_recovery line from your /etc/my.cnf file and restart the database. (It should start normally now)

Step 8: Restore everything from your backup

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress