How can I fix the collapsed WordPress database table?

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

How can I fix the collapsed WordPress database table?

Bkjia: WordPress databases may encounter faults and damages in various situations. One of its common problems is database crash ". In this case, 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 SELECT post_date_gmt FROM wp_posts WHERE post_status = 'Publish 'AND post_type IN ('post', 'page', 'attachment ') order by post_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

This type of database table crashes with a variety of symptoms. Your WordPress blog may have different exceptions, depending on which table is crashed. If the crashed table contains the "wp_posts" table of a series of blog posts, you will not be able to see any posts in the blog. The Xmodulo website encountered this database crash last weekend:

Xmodulo's WordPress blog is currently running by MySQL, so I will focus on MySQL in this tutorial.

Why does MySQL table crash?

The cause of the crash may be different. However, a database crash occurs when a host running mysqld or mysqld is forcibly disabled during database update. In the rest of the tutorial, I will introduce how to fix the collapsed WordPress MySQL database table.

Method 1

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

Log on to Cpanel and click "Databases" database ).

On the MySQL Databases page, you will find "Repair DB" to fix the database under "Modify Databases ).

Select the database that contains the crash table and click "Repair DB" to fix the database. If the repair is successful, the status of each table is displayed as "OK ".

 
 
  1. my_database.wp_oiopub_tracker_visits OK  
  2. my_database.wp_options OK  
  3. my_database.wp_postmeta OK  
  4. my_database.wp_posts  
  5. error : Keyblock size at page 13001728 is not correct. Block length: 532 key length: 2  
  6. Error : Incorrect key file for table './my_database/wp_posts.MYI'; try to repair it  
  7. error : Corrupt  
  8. ---------  
  9. After repair:  
  10. ----  
  11. my_database.wp_oiopub_tracker_visits OK  
  12. my_database.wp_options OK  
  13. my_database.wp_postmeta OK  
  14. my_database.wp_posts OK  
  15. my_database.wp_sharebar OK  
  16. my_database.wp_term_relationships OK 

Method 2

If you want to access 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 databases, you can use the command line utility named myisamchk to fix the crashed tables. This utility is installed with the MySQL server.

First, stop the MySQL server.

 
 
  1. $ sudo service mysql stop (Debian/Ubuntu)  
  2. $ sudo service mysqld stop (CentOS/RHEL)  
  3. $ sudo systemctl stop mysqld.service (Fedora) 

Then use this command to repair a table.

 
 
  1. $ cd /var/lib/  
  2. $ sudo myisamchk -r -v -f mysql/<database_name>/<table_name> 

Finally, start the MySQL server again.

Have you ever encountered a database crash or any other problems in the WordPress database? Do you regularly back up your WordPress database tables? Please tell us how you can solve this problem and maintain the database.
 

Http://xmodulo.com/2014/06/repair-crashed-wordpress-database-table.html.

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: info-contact@alibabacloud.com 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.