How To Fix “WordPress Database Error; Table Marked as Crashed and Should be Repaired”
Here’s a tutorial on how to fix “WordPress Database Error; Table Marked as Crashed and Should be Repaired” error that might appear on your site and thus render it unavailable to your readers.
While this WordPress database error might sound and appear scary, it has a relatively simple fix as you will find out below. The error might appear as:
1 2 3 |
WordPress database error: [Table './database_name/prefix_postmeta' is marked as crashed and last (automatic?) repair failed] SELECT post_id, meta_key, meta_value FROM wpvh_postmeta WHERE post_id IN (102) ORDER BY meta_id ASC WordPress database error: [Table './database_name/prefix_postmeta' is marked as crashed and last (automatic?) repair failed] SELECT post_id, meta_key, meta_value FROM wpvh_postmeta WHERE post_id IN (5) ORDER BY meta_id ASC |
or some code similar to the above.
Here are 2 methods How To Fix “WordPress Database Error; Table Marked as Crashed and Should be Repaired”:
1. Repairing Tables with phpMyAdmin.
Here are the steps on how to fix the database error via phpMyAdmin:
- Log in to your phpMyAdmin or connect to it via your cPanel back-end.
- Select the database with the crashed table.
- Put a checkmark next to each crashed table.
- Select “Repair table” from the “With selected:” drop-down at the bottom of the list.
- Let phpMyAdmin run the command.
You’re all done! Visit your site to make are the error has been fixed.
2. Repairing Via Shell Access
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
[user@server ~/public_html]$ mysql -u user -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1120449 Server version: 5.1.48 MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> connect database Connection id: 1120477 Current database: database mysql> select * from prefix_posts limit 1; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 1120568 Current database: database ERROR 145 (HY000): Table './database/prefix_posts' is marked as crashed and should be repaired mysql> repair table prefix_posts; +-----------------------+--------+----------+----------+ | Table | Op | Msg_type | Msg_text | +-----------------------+--------+----------+----------+ | database.prefix_posts | repair | status | OK | +-----------------------+--------+----------+----------+ 1 row in set (3.56 sec) mysql> select * from prefix_posts limit 1; +----+-------------+---------------------+---------------------+--------------+------------+---------------+--------------+-------------+----------------+-------------+---------------+-----------+---------+--------+---------------------+---------------------+-----------------------+-------------+------------------------------------------------------------+------------+------------+----------------+---------------+ | ID | post_author | post_date | post_date_gmt | post_content | post_title | post_category | post_excerpt | post_status | comment_status | ping_status | post_password | post_name | to_ping | pinged | post_modified | post_modified_gmt | post_content_filtered | post_parent | guid | menu_order | post_type | post_mime_type | comment_count | +----+-------------+---------------------+---------------------+--------------+------------+---------------+--------------+-------------+----------------+-------------+---------------+-----------+---------+--------+---------------------+---------------------+-----------------------+-------------+------------------------------------------------------------+------------+------------+----------------+---------------+ | 12 | 8 | 2008-05-20 10:09:49 | 2008-05-20 15:09:49 | | 308image1 | 0 | | inherit | open | open | | 308image1 | | | 2008-05-20 10:09:49 | 2008-05-20 15:09:49 | | 0 | http://gaarai.com/wp-content/uploads/2008/05/308image1.gif | 0 | attachment | image/gif | 0 | +----+-------------+---------------------+---------------------+--------------+------------+---------------+--------------+-------------+----------------+-------------+---------------+-----------+---------+--------+---------------------+---------------------+-----------------------+-------------+------------------------------------------------------------+------------+------------+----------------+---------------+ 1 row in set (0.00 sec) mysql> exit Bye [user@server ~/public_html]$ |
Your WordPress Database Error; Table has crashed error has now been fixed!
I hope the above tutorial helped. Leave a comment for further assistance if need be or just to say thank you 🙂
Recommended Posts
How To Disable WordPress Theme Update Notification (No Plugin)
September 14, 2021
How to Hide Featured Image in Single Post on WordPress
October 8, 2020
How to Track WordPress Site Searches in Google Analytics
October 6, 2020