content_image/661034.jpg
reason for it, to eliminate the need to use REPAIR TABLE . See Section B.3.3.3, “What to Do If MySQL Keeps Crashing” , and Section 16.2.4, “MyISAM Table Problems” . 

REPAIR TABLE  checks the table to see whether an upgrade is required. If so, it performs the upgrade, following the same rules as CHECK TABLE ... FOR UPGRADE . See Section 13.7.3.2, “CHECK TABLE Statement” , for more information. 

<img src='content_image/661034.jpg'>

## Important 

•Make a backup of a table before performing a table repair operation; under some circumstances the operation might cause data loss. Possible causes include but are not limited to file system errors. See Chapter 7, Backup and Recovery . 

•If the server exits during a REPAIR TABLE  operation, it is essential after restarting it that you immediately execute another REPAIR TABLE  statement for the table before performing any other operations on it. In the worst case, you might have a new clean index file without information about the data file, and then the next operation you perform could overwrite the data file. This is an unlikely but possible scenario that underscores the value of making a backup first. 

•In the event that a table on the source becomes corrupted and you run REPAIR TABLE  on it, any resulting changes to the original table are not  propagated to replicas. 

## REPAIR TABLE Storage Engine and Partitioning Support 

•REPAIR TABLE Storage Engine and Partitioning Support 

•REPAIR TABLE Options 

•REPAIR TABLE Output 

•Table Repair Considerations 

REPAIR TABLE  works for MyISAM , ARCHIVE , and CSV  tables. For MyISAM  tables, it has the same effect as myisamchk --recover tbl_name  by default. This statement does not work with views. 

REPAIR TABLE  is supported for partitioned tables. However, the USE_FRM  option cannot be used with this statement on a partitioned table. 

You can use ALTER TABLE ... REPAIR PARTITION  to repair one or more partitions; for more information, see Section 13.1.9, “ALTER TABLE Statement” , and Section 24.3.4, “Maintenance of Partitions” . 

## REPAIR TABLE Options 

• NO_WRITE_TO_BINLOG  or LOCAL 

By default, the server writes REPAIR TABLE  statements to the binary log so that they replicate to replicas. To suppress logging, specify the optional NO_WRITE_TO_BINLOG  keyword or its alias LOCAL . 

• QUICK 

If you use the QUICK  option, REPAIR TABLE  tries to repair only the index file, and not the data file. This type of repair is like that done by myisamchk --recover --quick . 

• EXTENDED 

