Runbook

Corrupted MySQL Tables

Back to Runbooks

Overview

Corrupted MySQL Tables refer to a type of incident where there is an error in the data held within a MySQL table, rendering it unreadable. This can result in the server crashing when attempts are made to read from the corrupted table. This issue can occur occasionally and can cause disruption to the normal functioning of the database. The incident requires troubleshooting to identify the cause of the corruption and to recover the data held within the table.

Parameters

Debug

Step 1: Check if MySQL is running

Step 2: Check the MySQL error logs for any recent errors

Step 3: Check the MySQL database for corrupted tables

Step 4: Check the MySQL log files for any clues

Check to see if the DB server shutdown leading to incomplete transactions.

Step 5: Attempt to repair any corrupted tables using mysqlcheck

Repair

Restore from Backup: If you have a recent backup of your MySQL database, restoring it to a point before the corruption occurred will resolve the issue. This is assuming that the backup itself is not corrupted.

Repair and Optimize: MySQL has a built-in repair and optimize function that can help fix corrupted tables. You can use the following command in the MySQL client: REPAIR TABLE tablename; or OPTIMIZE TABLE tablename;. If the repair function doesn't work, try the optimize function.

Attempt the MYSQL dump and reload method for corrupted tables

Learn more

Related Runbooks

Check out these related runbooks to help you debug and resolve similar issues.