Repair MySql Corrupt Table


Occasionally, due to the several reasons like multiple INSERTs and UPDATEs, load on the server, coupled with many SELECTs, improper use of database and hardware failure, your database may corrupt a table. Due to the corruption in the table of database, users are not allowed to access table and stored data in it.

Following is the error message a user can get after the corruption takes place in the table.

Incorrect key file for table: '...'. Try to repair it

Whenever user try to execute queries get incorrect information data.

Here are the following reasons responsible for the corruption in the table—

  1. In the middle of the write, Mysqld process being killed.
  2. Unexpected shutdown of the system.
  3. Hardware problem or fault.
  4. If user is using an external program on a live table.
  5. Software bug in the MySQL code.

User can repair corrupted MySql table by using repair.pho script or by using the command from the MySql prompt. This is not only used to rebuild index but also used to repair broken tables including missing blocks and modules. By using this command users are likely to get all data from corrupted table. If the table corruption is lot then user needs to find the other solution.

Resolution:

First check the corruption status in the table. Use the command “check table” to check if the table is corrupt.

Check table ‘table_name'

Now repair table by using following command—

Repair table ‘table_name'

If after this, user is not able to repair MySQL corrupt table then one can use the different approach for this. Use MySQL repair tool. This can easily repair and restore data from corrupted table. It can be used in any kind of corruption. This is nondestructive and read only software so that while repair process it doesn't modify any existing data from table.