Diagnose and Repair Corrupted MySQL Tables

Last updated: August 29, 2026.

The correct response depends on the storage engine and failure. Preserve evidence and backups before attempting repair; an operation appropriate for MyISAM is not the normal recovery path for InnoDB.

Identify and check the table

SELECT TABLE_SCHEMA, TABLE_NAME, ENGINE
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'appdb' AND TABLE_NAME = 'orders';

CHECK TABLE appdb.orders;

Choose the recovery path

  • For InnoDB, inspect the server error log and use documented recovery or restore procedures.
  • For MyISAM, use CHECK TABLE and supported repair tools only with a backup.
  • Correct failing storage or filesystem conditions first.
  • Restore to another location when preservation matters.
  • Verify row counts, constraints, and application queries afterward.

Choose recovery by storage engine

CHECK TABLE can help identify a problem, but the supported recovery path differs for InnoDB and MyISAM. Preserve backups and error logs before attempting any operation that changes damaged files.

Correct failing storage, memory, or filesystem conditions first. Restore into another location when possible, then verify row counts, constraints, and application queries before returning the table to service.

  • Do not apply MyISAM repair steps to InnoDB.
  • Keep an untouched recovery copy.
  • Test backups regularly before an incident.

Run administrative statements first in a controlled environment and record the current configuration. Keep a rollback or restore path, use least privilege, and verify the result through the same client path used by the application.

Continue with mysqldump restore errors and database size queries.

Practical implementation check

Before changing production, record the server version, relevant configuration, current object state, and a tested recovery path. Run the diagnostic query with an account that has only the permissions it needs. Apply the smallest change that addresses the evidence, then repeat the original check and monitor application behavior instead of assuming a successful statement completed the task.

Record the final setting or object state in the deployment notes, including why it was chosen. That evidence makes later capacity reviews, migrations, and incident response substantially faster.

Reference: MySQL 8.4 table maintenance reference.

admin

admin