This section discusses how to use myisamchk to
check or repair
MyISAM tables (tables that have
.MYI files for
storing data and indexes). The same concepts apply to using
isamchk to check or repair
ISAM tables (tables that have
.ISM files for
storing data and indexes). For general
myisamchk or isamchk
background, see Section 4.6.2, “myisamchk — MyISAM Table-Maintenance Utility”. Other table-repair
information can be found at Section 2.11.4, “Rebuilding or Repairing Tables or Indexes”.
You can use myisamchk to check, repair, or optimize database tables. The following sections describe how to perform these operations and how to set up a table maintenance schedule. For information about using myisamchk to get information about your tables, see Section 184.108.40.206, “Obtaining Table Information with myisamchk”.
Even though table repair with myisamchk is quite secure, it is always a good idea to make a backup before doing a repair or any maintenance operation that could make a lot of changes to a table.
myisamchk operations that affect indexes can
FULLTEXT indexes to be rebuilt with
full-text parameters that are incompatible with the values used by
the MySQL server. To avoid this problem, follow the guidelines in
Section 220.127.116.11, “myisamchk General Options”.
MyISAM table maintenance can also be done using
the SQL statements that perform operations similar to what
myisamchk can do:
For additional information about these statements, see Section 12.4.2, “Table Maintenance Statements”.
These statements were introduced in different versions, but all are available from MySQL 3.23.14 on. These statements can be used directly or by means of the mysqlcheck client program. One advantage of these statements over myisamchk is that the server does all the work. With myisamchk, you must make sure that the server does not use the tables at the same time so that there is no unwanted interaction between myisamchk and the server.