Repairing a MySQL database

2010-04-21
It sometimes happens that if your database server crashes, you may find that:
  • QM is not working because it cannot access the database
  • Qloaderd is not working because it cannot write to the queue_log table
  • You get weird errors when updating from an older version of QM
This sometimes happens even on systems that seemed to work fine for a long time.

In order to fix these issues, you should:
  1. stop MySQL - THIS IS EXTREMELY IMPORTANT
    /etc/init.d/mysqld stop
  2. check tables using myisamchk (use the same case as written here):
    myisamchk -c /var/lib/mysql/queuemetrics/*.MYI
  3. if any error is shown, repair tables:
    myisamchk -r /var/lib/mysql/queuemetrics/*.MYI
  4. after that, restart Mysql:
    /etc/init.d/mysqld start