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
1 2 3 | REPAIR TABLE table_name [, table_name ...] |
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:
1 2 3 | repair table my_crashed_table; |
And if you don’t want to do it with query, you can do it from PHPMyAdmin by following steps
1 2 3 4 5 | select the "Repair table" menu at the bottom and the crashed table should be repaired |
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)