How to repair a MySQL table?

Posted on In QA

After a server crash and restarting, MyBB reports a SQL Error as follows:

MyBB SQL Error
MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
145 - Table './mybb/mybb_sessions' is marked as crashed and should be repaired
Query:
SELECT * FROM mybb_sessions WHERE sid='40021925bd0494ea31...' AND ip='x.x.x.x' LIMIT 1

The dababase is MySQL. Please help. Thank you!

You can repair the table following these steps:

  1. Connect to the MySQL management console (through the mysql command) to the MySQL DB.

  2. Choose the DB by executing:

    use mybb;

  3. repair the mybb_sessions table by executing:

    repair table mybb_sessions;

If you can not use the console, you can execute the SQL in phpMyAdmin:

  1. Access phpMyAdmin

  2. Select your the mybb database

  3. Click on the “SQL” tab on the right side

  4. Type in the following SQL and execute it

    repair table mybb_session;

Leave a Reply

Your email address will not be published. Required fields are marked *