Mysql is considered as one of the reliable Relational Database Management Systems (RDBMS) that allows you to store the data safely in the form of tables. But at time when accessing the tables, you may face certain errors such as ‘Got error 127 when reading table ‘which lead to unexpected execution of queries and inaccessibility of database records.
These all problems indicate the table corruption and to get rid of this, you can either make use of backup or mysql repair software.
Consider a situation where while accessing mysql tables, you are received with the following error message in mysql error log:
"[ERROR] Got error 127 when reading table”
Cause:
Mysql got error 127 when reading table clearly indicates the table corruption which can occur due to a number of reasons like:
- When mysqld process is stopped suddenly
- Due to some kind of hardware issues
- Due to unexpected or abnormal system shutdown
- Because of errors associated with MySQL code or MyISAM/InnoDB code
- Due to modification of the same table by an external program as well as server at the same time
All of the above reasons are responsible for table corruption and thus leads to ‘Got error 127 when reading tables’.
Solution:
In order to fix ‘Got error 127 when reading datafile at record’ go through the following steps:
First of all, check the corruption using CHECK TABLE command along with the options like FAST, QUICK, and MEDIUM etc as
CHECK TABLE tablename [options]
If the result is positive, then repair table using REPAIR TABLE command along with options like QUICK, EXTENDED etc as
REPAIR TABLE tablename [options]
But if the above commands does not work, then you must delete the corrupt table but only if you have an updated backup. In case of inavailability of backup, use Mysql repair software which works to repair as well as restore the damaged mysql tables in an efficient manner along with maintaining data integrity.