快乐十分投注价格表:MySQL錯誤Table is marked as crashed and should be repaired的解決辦法

2013-09-02 08:02:23來源:Linux Today作者:

福彩有极速赛车吗 www.ipmpe.com MySQL 數據庫發現 Table ‘./wordpress/wp_posts’ is marked as crashed and should be repaired 錯誤,因為 wp_posts 表被損壞了,所以 WordPress 的文章都顯示不出來:

昨天一位 VPS 客戶說他的 WordPress 博客沒了,網站可以打開,但是文章都沒了,懷疑被黑。我們登陸客戶 VPS 后沒發現被黑跡象,然后進入 MySQL 數據庫發現 Table ‘./wordpress/wp_posts’ is marked as crashed and should be repaired 錯誤,因為 wp_posts 表被損壞了,所以 WordPress 的文章都顯示不出來:

# mysql -u root -p
Enter password:

mysql> use wordpress;
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 wp_posts;
ERROR 145 (HY000): Table './wordpress/wp_posts' is marked as crashed and should be repaired
mysql> Bye
修復 MySQL 數據庫數據表問題可以由 mysqlcheck 來解決,先用 mysqlcheck 查看一下:

# mysqlcheck -u root -p wordpress
Enter password:
然后添加 –auto-repair 參數自動修復,最好修復前備份一下數據庫:

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

# mysqlcheck -u root -p wordpress --auto-repair
Enter password:
wordpress.wp_commentmeta
error    : Table upgrade required. Please do "REPAIR TABLE `wp_commentmeta`" or dump/reload to fix it!
wordpress.wp_comments
error    : Table upgrade required. Please do "REPAIR TABLE `wp_comments`" or dump/reload to fix it!
wordpress.wp_links
error    : Table upgrade required. Please do "REPAIR TABLE `wp_links`" or dump/reload to fix it!
wordpress.wp_options
error    : Table upgrade required. Please do "REPAIR TABLE `wp_options`" or dump/reload to fix it!
wordpress.wp_postmeta
error    : Table upgrade required. Please do "REPAIR TABLE `wp_postmeta`" or dump/reload to fix it!
wordpress.wp_posts
error    : Table upgrade required. Please do "REPAIR TABLE `wp_posts`" or dump/reload to fix it!
wordpress.wp_term_relationships                OK
wordpress.wp_term_taxonomy
error    : Table upgrade required. Please do "REPAIR TABLE `wp_term_taxonomy`" or dump/reload to fix it!
wordpress.wp_terms
error    : Table upgrade required. Please do "REPAIR TABLE `wp_terms`" or dump/reload to fix it!
wordpress.wp_usermeta
error    : Table upgrade required. Please do "REPAIR TABLE `wp_usermeta`" or dump/reload to fix it!
wordpress.wp_users
error    : Table upgrade required. Please do "REPAIR TABLE `wp_users`" or dump/reload to fix it!

Repairing tables
wordpress.wp_commentmeta                       OK
wordpress.wp_comments                          OK
wordpress.wp_links                             OK
wordpress.wp_options                           OK
wordpress.wp_postmeta                          OK
wordpress.wp_posts                             OK
wordpress.wp_term_taxonomy                     OK
wordpress.wp_terms                             OK
wordpress.wp_usermeta                          OK
wordpress.wp_users                             OK

關鍵詞:MySQL