Search Our Database

How to repair MySQL database in DirectAdmin

Last updated on |

When you cannot access your website and you are seeing this kind of message:

SQL query:

DELETE FROM sessions WHERE expiry <1349879630

MySQL said:

#126 - Incorrect key file for table './your_database/sessions.MYI'; try to repair it

It is possible that the hosting server had crashed and rebooted. After the server has restarted, your database tables are out of synch due to sudden shutdown. To realign the database, you can repair your MySQL database to fix the problem.

Other possible error messages that require you to repair your MySQL database:

  • tbl_name.frm is locked against change
  • Can’t find file tbl_name.MYI (Errcode: nnn)
  • Unexpected end of file
  • Record file is crashed
  • Got error nnn from table handler

Instructions to repair MySQL database

1. Login to your DirectAdmin, click on “MySQL management” option.

2. Check the tick box beside the database you want to repair, and click “Repair” button below.

3. Wait until all result show OK, and you have done repairing the database.

Browse to your website and see if the error still persists.