20130522 mysql table marked as crashed - plembo/onemoretech GitHub Wiki
title: MySQL table marked as crashed link: https://onemoretech.wordpress.com/2013/05/22/mysql-table-marked-as-crashed/ author: phil2nc description: post_id: 4824 created: 2013/05/22 17:52:08 created_gmt: 2013/05/22 21:52:08 comment_status: closed post_name: mysql-table-marked-as-crashed status: publish post_type: post
MySQL table marked as crashed
That sounds bad, and it is. But the fix in my case was pretty simple. This happened on a WordPress instance that got slammed during load testing. The exact error in the Apache log was:
[ERROR] /usr/libexec/mysqld: Table './weblogs/wp_options'
is marked as crashed and should be repaired
Where weblogs is the name of my WordPress database and wp_options is a table in it. Scary. The site itself reported a database connection error. Fixing this required running mysqlcheck thus:
mysqlcheck -u root -p weblogs --auto-repair
I ran it first without the "--auto-repair" option because by that point I'd used up an entire day's reserve of courage. A more surgical method would have been to log onto the database as the root user using the mysql client and first verify the table really is broken:
use weblogs;
check table wp_options;
If it is, then you can run repair against that table alone:
repair table wp_options;
Then run "check table" again to confirm it is fixed. Google returned a ton of hits on the query "wp_options is marked as crashed and should be repaired", but I immediately set aside all the ones that sent you to phpMyAdmin because... life is just too short. Here are some posts that provided the right stuff:
Unexpected WordPress Database Table Error
Mysqlcheck: Quick guide for Sys admins
How To Repair Corrupted MySQL Tables Using myisamcheck
All the above articles do a good job of providing a way to verify the problem and a means of fixing it.
Copyright 2004-2019 Phil Lembo