Sep 13, 2018

How to fix MySQL: table index is corrupted

To rebuild a table with ALTER TABLE, use a “null” alteration; that is, an ALTER TABLE statement that “changes” the table to use the storage engine that it already has. For example, if t1 is an InnoDB table, use this statement:

mysql> ALTER TABLE t1 ENGINE = InnoDB;

To rebuild all tables in all databases, use the --all-databases option:

shell> mysqldump --all-databases > dump.sql
shell> mysql < dump.sql

See also: