REPAIR [NO_WRITE_TO_BINLOG | LOCAL] TABLE tbl_name [, tbl_name] ... [QUICK] [EXTENDED] [USE_FRM]
REPAIR TABLE repairs a possibly corrupted table. By default,
it has the same effect as
myisamchk --recover tbl_name
aria_chk --recover tbl_name
REPAIR TABLE works for Archive, Aria, CSV and MyISAM tables. For XtraDB/InnoDB, see recovery modes. For CSV, see also Checking and Repairing CSV Tables. For Archive, this statement also improves compression. If the storage engine does not support this statement, a warning is issued.
This statement requires SELECT and INSERT privileges for the table.
REPAIR TABLE statements are written to the binary log and will be replicated. The
NO_WRITE_TO_BINLOG keyword (
LOCAL is an alias) will ensure the statement is not written to the binary log.
When an index is recreated, the storage engine may use a configurable buffer in the process. Incrementing the buffer speeds up the index creation. Aria and MyISAM allocate a buffer whose size is defined by
myisam_sort_buffer_size, also used for
REPAIR TABLE is also supported for partitioned tables.
USE_FRM option cannot be used with this statement
on a partitioned table.
ALTER TABLE ... REPAIR PARTITION can be used
to repair one or more partitions.