How to fix InnoDB database corruption?

Check the log files. If you find InnoDB database corruption, follow the below mentioned steps:

Take a backup or mysql directory, which can be used to restore if anything goes wrong.

# cd /var/lib/

# tar -cxvf mysql.tar.gz mysql

//Stop mysql service
# /etc/init.d/mysql stop

Add the following line into /etc/my.cnf to make mysql read only
innodb_force_recovery = 4

Restart mysqld - Mysql will start as we have started in read only mode

//Take backup of all databases using mysqldump
# mysqldump -A > alltable.sql

Drop all databases which are corrupted

Database can be deleted by deleting related directory in /var/lib/mysql/ or from mysql command-line or from phpmyadmin

#mysql -u root -p

# DROP ;

//We can check available database using this command
# show databases;

//Stop mysql service
# service mysql stop

//Remove innodb log and data file
# rm -rf /var/lib/mysql/ib*

Remove or comment out innodb_force_recovery in /etc/my.cnf

//Start mysql sevice in read-write mode
# service mysql start

//Restore database from backup that we have taken
# mysql -u root -p dbname < alldb.sql

After restoring DB restart mysql. We have fixed the issue, if MySQL is able to restart successfully. If still issue persists, you will need to restore database from older backup.

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

Fix - PHPMyAdmin Error You should upgrade to MySQL 5.5.0 or later

Problem statement Recently we upgraded phpMyAdmin version from 4.0.10.12 to 4.5.3.1 in our...

How to Fix Error Forcing close of thread 310 user: 'root' in MySQL?

Problem Statement MySQL server keeps on shutting down. Error Message C:\Program...

Fix :: Unable to login at phpMyadmin after revoking MySQL root user

Problem Statement I am not able to login into phpMyadmin after revoking root user. Solution...

How to increase max_user_connections in Linux VPS?

More often you receive Too many connections error when you attempt to connect MySQL server. This...

How to change MySQL root password from WHM?

In this article, we will describe steps to change the root password of MySQL server from WHM....