John Connor
John Connor

Reputation: 3617

Table is marked as crashed and should be repaired

I am getting this error in WordPress' phpMyAdmin:

#145 - Table './DB_NAME/wp_posts' is marked as crashed and should be repaired 

When I login to phpMyAdmin, it says wp_posts is "in use"

My website is currently down because of this.

I googled this problem, but I don't see the "repair" button on phpMyAdmin. Please let me know how to fix this. I am not sure where to issue a PHP command. Please advise, my proficiency with PHP is very basic.

Upvotes: 262

Views: 374824

Answers (8)

Jack D
Jack D

Reputation: 183

I agree with @Nican you can follow the given steps. It works some times. I have faced the same Error many times in my experience. It’s not easy to find the corrupted table in the MySQL database. Low disk space could be a major cause of this error.

You can use a command to repair the corrupted or crashed MySQL table.

# myisamchk -r <table name>

Note: r means recovery mode

If it does not work, You can go for a difficult repair.

Step 1 – Shift a database to a safe location. Step 2- Create a new empty data and index file. Step 3- Copy the old data file back onto the newly created data file

Note: You must maintain the main backup copy to recover if something goes wrong.

If both solutions do not work for you, I strongly recommend you go for a stellar repair for MySQL. This one is my best friend in my bad situations. It saves my data many times

Upvotes: 0

Siraj Ali
Siraj Ali

Reputation: 604

Here is simple steps.

Go to phpmyadmin and checked that table which one crushed and then select Repair table option.

enter image description here

Upvotes: 5

RasoolLotfi
RasoolLotfi

Reputation: 326

When I got this error:

#145 - Table '.\engine\phpbb3_posts' is marked as crashed and should be repaired

I ran this command in PhpMyAdmin to fix it:

REPAIR TABLE phpbb3_posts;

Upvotes: 23

Dmitri
Dmitri

Reputation: 36290

This means your MySQL table is corrupted and you need to repair it. Use

myisamchk -r /DB_NAME/wp_posts

from the command line. While you running the repair you should shut down your website temporarily so that no new connections are attempted to your database while its being repaired.

Upvotes: 8

Arun Killu
Arun Killu

Reputation: 14233

I had the same issue when my server free disk space available was 0

You can use the command (there must be ample space for the mysql files)

REPAIR TABLE `<table name>`;

for repairing individual tables

Upvotes: 163

Nedudi
Nedudi

Reputation: 5949

Connect to your server via SSH

then connect to your mysql console

and

USE user_base
REPAIR TABLE TABLE;

-OR-

If there are a lot of broken tables in current database:

mysqlcheck -uUSER -pPASSWORD  --repair --extended user_base

If there are a lot of broken tables in a lot of databases:

mysqlcheck -uUSER -pPASSWORD  --repair --extended -A

Upvotes: 37

tylerl
tylerl

Reputation: 30857

Run this from your server's command line:

 mysqlcheck --repair --all-databases

Upvotes: 237

Nican
Nican

Reputation: 7935

Here is where the repair button is:

alt text

Upvotes: 265

Related Questions