Checking and Repairing Database Tables

The general procedure for table damage detection and correction is as follows:

  1. Check the table for errors.

    If the table checks okay, you're done. Otherwise, you must repair it.

  2. Make copies of the table files before beginning repair, just in case something goes wrong.

  3. Try to repair the table.

  4. If the repair operation fails, restore the table from your database backups and update logs.

The final step of the preceding procedure assumes that you've been performing database backups and have update logging enabled. If that's not true, you're living dangerously. Go read Chapter 11, "General MySQL Administration," to find out how to use mysqldump and how to turn on update logging. You don't ever want to be in the position ...

Get MySQL 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.