How to fix a crashed WordPress database table

Source: Internet
Author: User
Tags cpanel shared hosting wordpress database wordpress blog


The WordPress database may experience failures and corruption in various situations. One of the common problems it encounters is "database crashes." If this happens, you can find the following error message in the wordpress error log:

WordPress database Error Table './my_home/wp_posts ' is marked as crashed and last (automatic?) repair failed for query SEL ECT post_date_gmt from wp_posts WHERE post_status = ' publish ' and Post_type in (' Post ', ' page ', ' attachment ') ORDER by Pos T_DATE_GMT DESC LIMIT 1 made by require (' wp-blog-header.php '), WP, Wp->main, wp->send_headers, get_ Lastpostmodified, Get_lastpostdate, _get_last_post_time

The symptoms of this type of database table crash vary. Your WordPress blog may have a different exception, depending on which table crashes. If the broken table is a "wp_posts" table with a series of posts in it, you won't see any posts in the blog. The Xmodulo website encountered this database crash last weekend:


650) this.width=650; "src=" "style=" float: none; "title=" Qq20150120193824.png "alt=" Wkiom1takmbtjeu9aag1c9gjqj4868.jpg "/>

Xmodulo's WordPress blog is now run by MySQL, so I'll focus on MySQL in this tutorial.

Why does the MySQL table crash?

The cause of the crash may be different, but typically a database crash occurs when a host that is running in mysqld or mysqld is forcibly shut down during database updates. In the remainder of the tutorial, I'll show you how to fix a crashed WordPress MySQL database table.

The first of these methods

If you use a shared hosting service, you can usually access cpanel, which allows you to repair the database through the Cpanel Web interface.

Log in to cpanel and click "MySQL Databases" (MySQL database) under "Databases" (database) section.


650) this.width=650; "src=" Http:// "title=" Qq20150120193859.png "style=" Float:none; "alt=" wkiol1takz3twh0raae8fd3nod0291.jpg "/>

On the MySQL Databases page, you will find "Repair db" (Repair Database) under "Modify Databases" (Modify database) section.


650) this.width=650; "src=" Http:// "title=" Qq20150120193920.png "style=" Float:none; "alt=" wkiom1takmaapno3aags_lmesty439.jpg "/>

Select the database that contains the crash table and click the "Repair DB" (Repair Database) button. If the repair succeeds, you will see that the status of each table is displayed as "OK".


650) this.width=650; "src=" Http:// "title=" Qq20150120193936.png "style=" Float:none; "alt=" wkiol1takz2avdgraahjn7zewno244.jpg "/>

The second method of

If you have access to the root directory on the MySQL server running on the host (such as VPS), you can try the command line interface to fix the crashed database table.

For MyISAM types of databases, you can use a command-line utility called Myisamchk to fix a broken table. The utility is installed with the MySQL server.

First, stop the MySQL server.


650) this.width=650; "src=" Http:// "title=" Qq20150120194131.png "style=" Float:none; "alt=" wkiom1takmay1nhlaacsn209h_q077.jpg "/>

Then use this command to fix a table.

650) this.width=650; "src=" Http:// "title=" Qq20150120194147.png "style=" Float:none; "alt=" wkiol1takz2rlyxcaabv8ijwcgs377.jpg "/>

Finally, start the MySQL server again.

The article by the multi-backup to be reproduced, please specify the source

This article is from the "Big Meatball" blog, please make sure to keep this source

How to fix a crashed WordPress database table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.