| Each MySQL table is represented by an .frm file on | | | | is used with options, like QUICK, FAST, MEDIUM etc.: |
| disk, no matter which storage engine you use. An .frm | | | | CHECK TABLE tablename [options] |
| file describes the table definition and possesses the | | | | If you are using MyISAM, you can alternatively run |
| same name as of table. The corruption of .frm file | | | | ‘mysqlcheck’ or ‘myisamchk’ |
| leads to table inconsistencies. It could happen due to | | | | command-line utilities. |
| improper locking of table, DLL file errors, system faults, | | | | - If database check reports table corruption, you need |
| disk issues, virus attack, unexpected shutdown etc. | | | | to repair it next. Before repairing, make sure that about |
| You need to use your recent data backup to restore | | | | twice as much disk space as of affected table is |
| data in such situations. However, if data backup exists | | | | available. Use REPAIR TABLE command with options, |
| in invalid state, or is not available at all, you need to use | | | | like QUICK and EXTENDED. The syntax is: |
| MySQL Database Recovery applications that prove to | | | | REPAIR TABLE tablename [options] |
| be safe tools for repairing damaged MySQL | | | | For MyISAM tables, use of ‘mysqlcheck’ or |
| databases. | | | | ‘myisamchk’ is also applicable. |
| You might receive the following error message with | | | | - If above measures fail to fix table corruption, you |
| MySQL database table(s): | | | | need to delete the damaged table if valid backup |
| “<table_name>.frm is locked against | | | | exists. |
| change” | | | | - If no backup is available, or you find backup in invalid |
| Cause | | | | state, make use of commercial MySQL Recovery |
| The primary cause for the occurrence of above error | | | | applications to repair and restore damaged MySQL |
| message is corruption of .frm file. | | | | tables. Such software are complete database repair |
| Solution | | | | products that scan corrupted databases using |
| In order to correct such corruption errors, you require | | | | powerful scanning algorithms. These MySQL |
| following these steps: | | | | Database Recovery tools provide automated |
| - You need to first ensure about table corruption. To | | | | recovery options together with interactive interface |
| perform this check, use CHECK TABLE command | | | | and read-only design. |
| while server is running. It follows the below syntax and | | | | |