‘table_name.frm is locked against change’


Most of the time, Microsoft Outlook users encounter with the error message –

".frm is locked against change"

The primary reason for the occurrence of this error is corruption in the MySQL tables. On disk MySQL table is represented by an .frm file. It doesn't matter which database engine you are using. An .frm file describes the table definition and contains the same name as of table. Due to the corruption in the .frm file there will be inconsistency of tables.

This happens due to improper locking of table, DLL file errors, disk issues, system faults, unexpected shutdown and virus attack. In this situation there may be possibilities of inaccessibility of table stored data. This means loss of data stored in table.

To correct and fix the corruption issue in database, perform these following steps---

  1. First make sure that your table gets corrupted and for that you can perform this check. For this use CHECK TABLE command while server is running. Use this command with following options-- like QUICK, FAST, MEDIUM etc.:

    CHECK TABLE tablename [options]

    If you are using MyISAM, you can alternatively run ‘mysqlcheck' or ‘myisamchk' command-line utilities.

  2. If it confirms that MySQL table is corrupted then next you need to perform the repair process. But before repair process makes sure that you have as much as disk space as of affected table is available.
  3. Now use REPAIR TABLE command with options, like QUICK and EXTENDED. The syntax is:

    REPAIR TABLE tablename [options]

    For MyISAM tables, use of ‘mysqlcheck' or ‘myisamchk' is also applicable.

If even after this you fail to fix the table corruption then you should delete the table which has been corrupted or damaged and then try to restore it with the backup file which you have with you recently. If you are not having valid or recent backup then you can use this third party tool to repair corrupted or damaged MySQL table.

Tool support recovery of database file for both InnoDB (.ibdata, .ibd and .frm) and MyISAM (.myd, .myi and .frm) database storage engines. It can also restore all database objects, like tables, relations, primary key(s), and others. This tool is easy and efficient one which is compatible with all latest Windows operating system.