Myisamchk fails to repair MySQL Database Tables
Consider a practical situation, where your table is corrupted and you experience the below error message:
"undef error - DBD::mysql::db selectrow_array failed: Table 'attach1_data' is marked as crashed and should be repaired [for Statement "SELECT LENGTH(thedata) FROM attach1_data WHERE id = ?"] at Bugzilla/Attachment.pm line 344 Bugzilla::Attachment::datasize('Bugzilla::Attachment=HASH(0x9df119c)') called"
From the error message, it is crystal clear that the table "attach1_data" is corrupted and need to be repaired. The above error message pops up every time you endeavor to access the records stored in "attach1_data" table.
How to Resolve?
To resolve the above error message and access the records stored in "attach1_data" table, follow the underneath steps:
Check the table by using myisamchk command.
Repair the table using myisamchk -r command.
Note: To avoid "clients are using or haven´t closed the table properly" error message, then perform repair after shutting down mysqld.
Myisamchk command repairs corrupted tables in most circumstances. But if the command repair command fails to repair and the error message remains, then you will need make a selection of an advanced MySQL Recovery software that repair your database. These MySQL Repair tools use effective scanning algorithms to perform standardized repair of corrupt tables.