There are number of factors which are responsible for the corruption of MySQL server’s MyISAM table. Few of the most common causes are like simultaneous modification of tables by two different applications, improper system shutdown, killing of MySQLD process in middle of write operation, MySQL bugs, virus attacks etc.
A common symptom that confirms the MyISAM table corruption is the occurrence of error messages when user tries to access the records saved in a table. Soon after the error message is thrown MyISAM table becomes inaccessible and in extreme cases the data might get lost.
In order to access the table records in such cases, the database need to be restored using the available backup. But in case, backup is not available or has corrupted, then the only option left with the user is to use any third party software which effectively repairs the corrupted table and makes it accessible.
In order to understand the situation better, let’s consider a practical scenario where you use myisamchk (external program) to change the records saved in a table say ABC table. The same table is being modified by the server at the same time when the previous one is working on it.
However, when the myisamchk completes its task and you attempt to view the records saved in 'ABC' table you encountered with the below mentioned error –
"Incorrect key file for table – '...'. Try to repair it".
After the above mentioned error message appears, all the records stored in ABC table become inaccessible and no rows are displayed in the ABC table when the query is executed for this table.
This error message has caused due to the simultaneous modification of ABC table by both myisamchk and server. In order to resolve the MyISAM table corruption and to access the ABC table data, following things need to be done –
- Use 'CHECK TABLE' command to check the health of ABC table.
- Use 'REPAIR TABLE' command to repair the ABC table.
The above mentioned commands are very effective and can repair the ABC table in most of the cases. But if these commands fail to repair the database table and the issue of corruption persists, then in these situations you need to use any third party tool.
Try MySQL Repair software which is efficient enough to repair the corrupted MyISAM tables and recovers the lost or missing data in a safe and secure place which can easily be restored. It uses its sophisticated and advanced algorithm to perform the entire scanning of corrupted table data and retrieves it effectively irrespective of the degree of its damage.