Back to Top

How To Repair MySQL Table

how-to-repair-mysql-table

If your table crashed, your websites stop working and if your website’s main content is coming from that crashed table, you might feel the tension.what now?. Am I right?

Well, Don’t worry because you need to repair your table.REPAIR is to repair a crashed or corrupted table.One more important thing is we can repair table if its storage engine is MYISAM or ARCHIVE.

If you are using InnoDB, restore the table from a backup. The common reason behind InnoDB table crashed if the lack of disk space.

You can see one of the useful information that is How to avoid to use ENUM and SET type in MySQL

It’s might take the time to repair the table that depends upon a size of tables. It takes few seconds to repair few KB table, and Its takes few minutes to repair for a few MB table and can take hours if the table is in a few GB. To restore huge table better option is to restore it from backup but if you don’t have the backup we can restore it but you need to face long repair process.

Here is the Syntax REPAIR TABLE

REPAIR TABLE works only on Storage Engine such as MyISAM and for each repaired table you can get many rows of information after optimizing database tables.The InnoDB table can not be recovered as it does not support the recovery.

NOTES: It is better to take the backup of the table before you repair the table because if the repair fails, can lead to data loss.

Let’s move to repairing a table.

To repair a table you can directly apply a query like:

And if you don’t want to do it with query, you can do it from PHPMyAdmin by following steps

Described steps of PHPMyAdmin are fortunately easy and quick so non-technical readers can also resolve the issue quickly and easily and everything must be restored!

Hope, This article help you if any crash occurs in your database.one more thing sometimes the repair query doesn’t repair the database so you need to use MySQL recovery Software.

At last, Take Backup of your data often and be relax 🙂

Comments (1)

  1. I could read a book about this wtoihut finding such real-world approaches!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to use Triggers in MySQL

Posted on 12 years ago

Bhumi

PHP Error Reporting Levels

Posted on 12 years ago

Bhumi