Wednesday, March 17, 2010

Repairing Corrupt MySQL Tables

Drat... My MythTV's MySQL database got corrupt somehow. I noticed some strange problems with the guide data over the past couple weeks and today, the guide data ran out. When I ran "mythfilldatabase" on the command-line, I noticed a weird error from MySQL suggesting the tables were corrupt.

A couple of google searches later, I found a great reference guide (http://www.thegeekstuff.com/2008/09/how-to-repair-corrupted-mysql-tables-using-myisamchk/) that discusses how to use myisamchk to find corrupt tables and then repair them. Worked like a champ.


cd /var/lib/mysql/mythconverg
myisamchk *.MYI
# in my case, only one table was corrupt
myisamchk -r CORRUPTTABLE.MYI

No comments: