top of page
CerebroSQL

REPAIR TABLE

База данных: MySQL

68747470733a2f2f7374796c65732e7265646469746d656469612e636f6d2f74355f32716d366b2f7374796c65

Syntax:
REPAIR [NO_WRITE_TO_BINLOG | LOCAL]
TABLE tbl_name [, tbl_name] ...
[QUICK] [EXTENDED] [USE_FRM]

REPAIR TABLE repairs a possibly corrupted table, for certain storage
engines only.

This statement requires SELECT and INSERT privileges for the table.

Although normally you should never have to run REPAIR TABLE, if
disaster strikes, this statement is very likely to get back all your
data from a MyISAM table. If your tables become corrupted often, try to
find the reason for it, to eliminate the need to use REPAIR TABLE. See
https://dev.mysql.com/doc/refman/8.0/en/crashing.html, and
https://dev.mysql.com/doc/refman/8.0/en/myisam-table-problems.html.

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 [HELP CHECK TABLE], for more information.

*Important*:

o 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 https://dev.mysql.com/doc/refman/8.0/en/backup-and-recovery.html.

o 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.

o 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.

URL: https://dev.mysql.com/doc/refman/8.0/en/repair-table.html

Example

bottom of page