After a long, hard day of fetching and editing tables, MySQL can become overburdened and create overhead. This can be almost directly compared to how defragmentation occurs on a hard drive. For example, something needs to be replaced in one location but there is not enough space so part of it goes here and part goes there; discontinuous. Over time, overhead for very active tables in your database can reach high levels and the result will be something like what happened to me in March. You can ensure a healthy database by following this quick fix every once in a while.
1) Locate and login to your phpMyAdmin client.
2) Select the database and click on the name of the database (circled).

3) You should see all of the tables for your database.

4) Select the checkboxes for each table that has an overhead value.

This was only for example. Tables with an overhead value under a kilobyte aren’t really anything to worry about.
5) Go to the drop-down menu with selected on the bottom and select repair.
6) If everything works out, you will see the something like the image below.

7) Clicking on the database name again should show the screenshot below, with no overhead for any of the tables. That’s it!

Tweet This
Stumble This


{ 17 trackbacks }
{ 47 comments… read them below or add one }
Thanks, nice tip
Ben
More from author
cool!
thanks for the quickies- so easy to understand, I could do it in my sleep! Now, if only I could get myself to “sleep surf”….
More from author
thats awesome
More from author
Apparenltly, I had a lot of overhead. Now its all gone, thanks!
More from author
Thanks for this tut, Paul! I’m usually wary about tinkering with stuff on my server because I’m still a relative n00b at it. This helps me out a lot.
More from author
And why not optimize all the tables at the same same time? ;-)
Check all —> optimize. Can/will quite often reduce the size of the database quite impressively (up to 10% or even more).
More from author
Yeah what franky said. =D
More from author
Thanx a lot for the tut.
Just a few days ago, my database went kaput. :( I restored from a backup but that was a few days old — so I lost some comments.
More from author
If my database is not open how i can fix the tables?. the phpmyadmin does not open.
Thanks
More from author
Good advice, thanks a lot. I’ve been creating, changing, deleting a lot of tables. Was beginning to wonder what this overhead deal I was seeing was about. Cleaned it all up nicely. Happiness abounds….
More from author
tips, dont over optimize ur table too often, unless you want to increase the table lock.
More from author
Thanks a lot !!!
Hey thanks very very much. That would have taken me forever to figure out.
More from author
Thanks! I can’t believe how easy that was… I was afraid I’d have to rebuild my whole DB… Ouch. And then all I needed to to was select Repair. The wonders of modern technology. At least now I know to check my DBs from time to time. :)
More from author
Thanks for taking the trouble to stick it on the web. It worked perfectly.
Glad to find this at the top of google for repair mysql table
good lookin out
More from author
Thanks a lot !!!
Thanks for this post. phpMyAdmin is so convoluted that even though I’ve done this before I couldn’t remember how to do it a second time. I’m glad I found this.
More from author
Thanks man. I was wondering what was happening to my mysql database. Saved my forum! :]
More from author
Hi Paul. Last night I received this error:
MySQL said:
#1194 – Table ‘wp_options’ is marked as crashed and should be repaired
I basically panic’ed and turned some more of my hair into grey hair
But – I found this post and you literally saved me from doing something silly, like restoring a backup, or backstepping to the taped backups, etc … all I needed to do was repair the affected table like you suggested and everything worked out pretty good.
Thanks for the tip. It’s timeless.
More from author
Thanks for your help, Paul. I have been running around like a crazy man for the past two (2) days trying to resolve this error before my class presentation day. Finally, i came across your post and that helped me to resolved my problem. Kudos to you!!!!.
This tip is very useful for MySQL admins…..
More from author
I am fairly new at these thing..my site whent down and did not know what to to!!I found your post and everything is good now!!!!
THANK YOU VERY VERY VERY MUCH!!!!!
Thx for tips
More from author
thanks, you just saved my blog!
the wp_options table had crashed..
the blog was showing the WordPress install page and erroring out if I ran the install.
your fix sorted it out!!
:)
Matt Garrett
More from author
Really useful article!! Thank you
I found a couple quick mysqlcheck commands that optimize and repair MySQL databases on the following site: http://tuxrx.org/content/repairing-and-optimizing-mysql-databases
Good article. My problem is related, I suspect, but different.
All the data on my damaged table seems to have disappeared into the overhead area. When I browse the table, no records show, but autoindex shows 265. The material was being properly recorded until some unknown recent event. The overhead item shows 14,625 b in it.
1) Is there any way to recover the data that is in the overhead section? Optimize will just erase it. Can “repair” be used to fix it?
2) Any ideas as to what might have caused this problem? (All the other tables on the database seem to be working properly, and the data entry person doesn’t remember anything unusual happening.)
Thanks for any help you can offer.
Tim
More from author
Thanks. My Search Index in Phpbb3 is working now !
More from author
Thanks for great tips, i’m googling and found this information really useful. My website based on drupal and facing this problem.
More from author
you just saved me pulling my hair out!!!!
Cheers
More from author
Hi,
How long does REPAIR table takes?
I have it running right now for more than 2 hours.
Query | 9724 | Repair by sorting | REPAIR TABLE BettingOfferArchive QUICK
these are the files sizes. Please comment.
-rw-rw—- 1 mysql mysql 1158317853 Sep 11 08:44 BettingOfferArchive.MYD
-rw-rw—- 1 mysql mysql 1102354432 Sep 12 00:40 BettingOfferArchive.MYI
-rw-r—– 1 root root 248512512 Sep 12 02:39 BettingOfferArchive.TMD
-rw-rw—- 1 mysql mysql 8688 May 27 22:14 BettingOfferArchive.frm
It has been running for more than 2 hours. Why?
10434 | Repair by sorting | REPAIR TABLE BettingOfferArchive QUICK
——-
-rw-rw—- 1 mysql mysql 1158317853 Sep 11 08:44 BettingOfferArchive.MYD
-rw-rw—- 1 mysql mysql 1102354432 Sep 12 00:40 BettingOfferArchive.MYI
-rw-r—– 1 root root 248512512 Sep 12 02:39 BettingOfferArchive.TMD
-rw-rw—- 1 mysql mysql 8688 May 27 22:14 BettingOfferArchive.frm
Found your site from Google while I was searching on how to Optimize my wordpress database. Thanks to your post, I have reduced my headache to minimal. :)
More from author
Thanks, Saved me from my morning warning:
“/phpbb_sessions’ is marked as crashed and should be repaired”
More from author
Worked for me. Thank you.
Thanks for the tip!
More from author
Thank you very much for this clear tutorial!
More from author
Hi all,
I have got this error
table “xyz” is marked as crashed and last (automatic?) repair failed..
What to do..
Thx
I’m having a problem displaying more than one category. From some of the other message boards I’ve read, I can see that other people are having a similar problem.
I go to the admin Dashboard and open the Categories page. I can add new categories and sub-categories here, but they never show up on the blog page. I am able to edit the original (”uncategorized”) category to another name, but that is all.
I “repaired” all of my MySQL tables, as suggested, but this didn’t help. By the way, I don’t see a wp_category table in my database (described in some older documentation), but I do see the name of my (missing) category in the wp_terms table as well as the description of the (missing) category in the wp_term_taxonomy table.
These are the 10 tables in my MySQL database:
wp_comments
wp_links
wp_ptions
wp_postmeta
wp_post
wp_terms
wp_termwp_relationships
wp_termwp_taxonomy
wp_metadata
wp_users
I think I’m using 2.7. I installed it through the GoDaddy interface.
Can anyone help me? Thanks !!!
Jerry Bucknoff
PM Best Practices
More from author
Thanks Paul.
You’re tip was exactly what I needed to repair a crashed table.
My next option was to go to a back up of the table and loose a weeks worth of work.
Thanks again.
LR
Thanks.
This has solved so many problems that I didn’t understand.
Thanks
More from author
Lifesaver… love the quick tips you’ve written – brilliant – thank you!
You are a LIFESAVER!
Brilliant and I did not have to spend the whole day
trying to fix my database. THANKS A LOT!
More from author
I followed your instructions but have many that say they’ve “been marked as crashed and should be repaired”. Is there anything else I can do?
Here’s a screen shot of the error messages:
Screen Shot
More from author
Great tip!
thanks a lot for the tutorial. It saved my day.
More from author