:: DEVELOPER ZONE
MyISAM Tables for Errors
The following text discusses how to use myisamchk to check or repair
MyISAM tables (tables with .MYI and .MYD files).
The same concepts apply to using isamchk to check or repair
ISAM tables (tables with .ISM and .ISD files).
See Chapter 14, MySQL Storage Engines and Table Types.
You can use the myisamchk utility to get information about your database tables or to check, repair, or optimize them. The following sections describe how to invoke myisamchk (including a description of its options), how to set up a table maintenance schedule, and how to use myisamchk to perform its various functions.
Even though table repair with myisamchk is quite secure, it's 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 cause
FULLTEXT indexes to be rebuilt with full-text parameters that
are incompatible with the values used by the MySQL server. To avoid this,
read the instructions in
Section 5.7.3.2, “General Options for myisamchk”.
In many cases, you may find it simpler to do MyISAM table maintenance
using the SQL statements that perform operations that myisamchk can
do:
To check or repair MyISAM tables, use CHECK TABLE or
REPAIR TABLE.
To optimize MyISAM tables, use OPTIMIZE TABLE.
To analyze MyISAM tables, use ANALYZE TABLE.
These statements were introduced in different versions, but all are available
from MySQL 3.23.14 on.
See
Section 13.5.2.1, “ANALYZE TABLE Syntax”,
Section 13.5.2.3, “CHECK TABLE Syntax”,
Section 13.5.2.5, “OPTIMIZE TABLE Syntax”,
and Section 13.5.2.6, “REPAIR TABLE Syntax”.
The statements can be used directly, or by means of the mysqlcheck
client program, which provides a command-line interface to them.
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. Otherwise, there can be unwanted interaction between myisamchk and the server.
© 1995-2005 MySQL AB. All rights reserved.

User Comments
Add your own comment.