Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
MyISAM stores every table as a set of three files:
table_name.frm contains the table structure (schema),
table_name.MYD contains the data, and
table_name.MYI contains the index. Corruption can
damage the datafile, the index file, or both. In such cases, you will
get an error like "ERROR 126 (HY000): Incorrect
key file for table './test/t1.MYI'; try to repair it" or
"Table './test/t2' is marked as crashed and
last (automatic?) repair failed" when you access the table.
The error message can vary, but check for the words “repair” or
“crashed” as a clue that the table is corrupted.
The SQL statements CHECK
TABLE and REPAIR TABLE
troubleshoot corruption. From the operating system shell, you can also
used the myisamchk utility for
the same purpose. One advantage of myisamchk is that you can use it without
access to a running MySQL server. For instance, you can try to repair a
table after a crash before bringing up the server again.