1. 程式人生 > >mysql解決Table ‘./xxx/xxxxxx’ is marked as crashed and should be repaired 錯誤

mysql解決Table ‘./xxx/xxxxxx’ is marked as crashed and should be repaired 錯誤

mysql解決Table ‘./xxx/xxxxxx’ is marked as crashed and should be repaired 錯誤

然後進入 MySQL 資料庫發現 Table ‘./xxx/xxxxxx’ is marked as crashed and should be repaired 錯誤,因為 xxxxxx表被損壞了,所以 WordPress 的文章都顯示不出來:

mysql -u root -p
Enter password:

mysql> use xxx;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> 
select
 * from xxxxxx; ERROR 145 (HY000): Table './xxx/xxxxxx' is marked as crashed and should be repaired mysql> Bye

修復 MySQL 資料庫資料表問題可以由 mysqlcheck 來解決,先用 mysqlcheck 檢視一下:

# mysqlcheck -u root -p xxx
Enter password:

然後新增 –auto-repair 引數自動修復,最好修復前備份一下資料庫:

# mysqldump -u root -p xxx> xxx.sql
Enter password:

# mysqlcheck -u root -p xxx--auto-repair
Enter password:
xxx.xxxxxx
error    : Table upgrade required. Please do "REPAIR TABLE `xxxxxx`" or dump/reload to fix it!

Repairing tables
xxx.xxxxxx    OK