Table is marked as crashed and should be repaired

MysqlDatabaseWordpress

Mysql Problem Overview


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 PHP command. Please advise, my proficiency with PHP is very basic.

Mysql Solutions


Solution 1 - Mysql

Here is where the repair button is:

alt text

Solution 2 - Mysql

Run this from your server's command line:

 mysqlcheck --repair --all-databases

Solution 3 - Mysql

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

Solution 4 - Mysql

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

Solution 5 - Mysql

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;

Solution 6 - Mysql

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.

Solution 7 - Mysql

Here is simple steps.

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

enter image description here

Solution 8 - Mysql

I had issues with my general log on my dev server. I was able to run the following in the mysql cli to fix the issue.

truncate table general_log;

Note, this will delete all the contents of the table.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJohn ConnorView Question on Stackoverflow
Solution 1 - MysqlNicanView Answer on Stackoverflow
Solution 2 - MysqltylerlView Answer on Stackoverflow
Solution 3 - MysqlArun KilluView Answer on Stackoverflow
Solution 4 - MysqlNedudiView Answer on Stackoverflow
Solution 5 - MysqlRasoolLotfiView Answer on Stackoverflow
Solution 6 - MysqlDmitriView Answer on Stackoverflow
Solution 7 - MysqlSiraj AliView Answer on Stackoverflow
Solution 8 - MysqlRichard Tyler MilesView Answer on Stackoverflow