Name

CHECK TABLE

Synopsis

CHECK TABLE table[,  . . . ] [CHANGED|QUICK|FAST|MEDIUM|EXTENDED|]

Use this statement to check MyISAM and InnoDB tables for errors. If errors are discovered, you should run the REPAIR TABLE statement to repair the table. Multiple tables may be given in a comma-separated list. There are several methods of checking. The CHANGED method checks only tables that have been changed since the last check. The QUICK option will check tables for errors, but won’t scan individual rows for linking problems. The FAST option instructs MySQL to check only tables that have not been closed properly. The MEDIUM option determines the key checksum for the rows and compares the results against the checksum for the keys. It also checks rows to ensure that links were deleted properly. The EXTENDED method thoroughly checks each row for errors. Here is an example of how you can use this statement.

CHECK TABLE workreq MEDIUM;
+----------------------+-------+----------+----------+
| Table                | Op    | Msg_type | Msg_text |
+----------------------+-------+----------+----------+
| workrequests.workreq | check | status   | OK       |
+----------------------+-------+----------+----------+

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.