How to repair MySQL table
From Kolmisoft Wiki
Jump to navigationJump to search
If you can't open GUI and you see something similiar in your /home/mor/log/production.log:
ActiveRecord::StatementInvalid (Mysql::Error: Table 'calls' is marked as crashed and should be repaired: SELECT * FROM calls WHERE (dst_device_id =189 AND disposition != 'ANSWERED' AND calldate BETWEEN '2008-11-07 00:00:00' AND '2008-11-07 23:59:59') ORDER BY calldate DESC):
That means table 'calls' should be repaired. Log in into mysql console, choose your mor database (usually mor) and do:
repair table damaged_table; <ENTER>
Thats it, table should be repaired now.
mysql> repair table calls; +-----------+--------+----------+----------+ | Table | Op | Msg_type | Msg_text | +-----------+--------+----------+----------+ | mor.calls | repair | status | OK | +-----------+--------+----------+----------+ 1 row in set (1 min 18.25 sec)
mysql> exit Bye
If this doesn't help, try connecting to your server and doing:
#shell$:/ cd /var/lib/mysql #shell$:/ myisamchk -r -q broken_table_name #shell$:/ /etc/init.d/mysqld restart