Fixing Error 1142 - Post MySQL Database Corruption

Published: 04th June 2010
Views: N/A

MySQL database table corruption can occur due to various reasons, one of them being importing of incorrect table structure in the database. Once the database gets corrupted due to the above reason, it becomes unmountable. In most of these situations, you encounter an error message while trying to access or drop any MySQL database table. To overcome such database corruption situations, the user needs to run innodb_force_recovery command with an appropriate value. Although the command is successful in repairing MySQL table in most cases, it might fail to repair if the database table is severely damaged. For such cases, the user needs to restore the database table from an up-to-date backup. But, if in case of no database table availability or backup falling short to restore the exact table, then the user needs to search for a third-party MySQL Database Repair application that can repair all the tables.

To explain the above situation in detail, consider a below scenario where you have a MySQL database and attempt to import a table structure into it. However, after you have done so and try to access the records saved in the the database table, you encounter the below error message:

"error #1142 - SELECT command denied to user 'abc'@'localhost' for table 'test'"

Furthermore, you are also not able to delete the table as you encounter the below error message while running delete command:

"error #1142 - DROP command denied to user 'abc'@'localhost' for table 'test'"


The above error message appears when the MySQL database table is corrupted or damaged.


To resolve the above error message and access the records saved in table, you will need to take underneath actions:

Try to repair the corrupt InnoDB table by using 'innodb_force_recovery=4' command. The command provides successful results in most situations.

However, if the database table remains corrupted even after using the above commands, then you will need to restore the data from an updated backup.

In case of no backup availability, you will need to repair the database by using an effective and secure

Video Source: Youtube

More to Explore