It is easy to understand that MySQL contains corrupted MyISAM tables, even if the MyISAM table is very reliable (all changes made to the SQL statement table are written before the statement returns), if any of the following events occur, you can still obtain the damaged table:
? The MySQLd process is killed during write.
? An unexpected computer shutdown occurs (for example, the computer is shut down ).
? Hardware faults.
? You can also use external programs (such as myisamchk) on the tables being modified by the server ).
? Software defects of MySQL or MyISAM code.
Typical symptoms of a damaged table are as follows:
? When selecting data from a table, you get the following error:
? Incorrect key file for table: '...'. Try to repair it
? The query cannot find rows in the table or return incomplete data.
You can use the check table statement to CHECK the health of the MyISAM TABLE and use the repair table to REPAIR a damaged MyISAM TABLE. When mysqld is not running, you can also run the myisamchk command to check or repair a table.
If your table becomes corrupted frequently, you should try to determine why. The most important thing to understand is whether the table becomes corrupted because of a server crash. You can find the latest restarted mysqld message in the error log to verify this message early. If such a message exists, it is very likely that the table is damaged because the server is dead. Otherwise, the damage may occur during normal operations. This is a defect. You should try to create a repeatable test case that shows the problem.