This morning I woke up to find one of the sites I administer down. The error on the page was very clear in that it could not connect to the database due to a corrupt table. I had two choices, recover from a backup or attempt to repair the corrupted tables. I opted to try the repair. In the end, it worked. And now, you will get to benefit from that success.
The initial problem was trying to figure out which table was corrupt. The database in question wasn't HUGE, by any stretch of the imagination; but it was big enough that an attempt to repair all tables would have taken quite some time. Fortunately, when I went to restart MySQL, the output of the command even helped me narrow down the corrupted table. In this article I will show you my process for repairing this corruption.
As I said, the error message I received only pointed me in the right direction. What the error message indicated was that there was corruption in the cache. This wound up only be part of the issue. But I had a starting point. So the first steps were to locate the exact name of the cache table in the database. Here's how this is done.
That should do it. You should now be able to restart your MySQL database server and your web site should be able to connect to its database.
AdvertisementPlease click on the following link to open the newsletter signup page: Ghacks Newsletter Sign up
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.
Sounds like bad sectors on a drive……
I would take a preventative look at that, before your tables go corrupt again [;-)
They only take a dump like that if there was some serious conflict during a row level lock, or bad write (bad sector).
thanks for the post… a reminder that i should use MySql command line more often.. im getting too reliant on PHPmySql.
Well, myisamchk is only useful if you have MyISAM tables, if your db is built with InnoDB tables there is no use for this tool.
I am fully sure about that Kernel for MySQL database repair tool is a best software to repair and recover corrupt or deleted MySQL table. Software show you the preview of recovered data items such as Tables, Triggers, Views and Primary Keys in a tree like structure after restoring the corrupt MySQL database file.