首页 > 代码库 > 【mysql】 is marked as crashed and should be repaired

【mysql】 is marked as crashed and should be repaired

-备份数据库时报错


[ERROR] /usr/sbin/mysqld: Table ‘./daifans/wp_options‘ is marked as crashed and should be repaired


- 在网上查了文档,说是表损坏,所以 WordPress 的文章都显示不出来,需要修复,修复前需要备份

  1. 我备份时也出错了,说是损坏的那个表备份不了的意思,我就用排除废表备份其他的

    # mysqldump -uroot -p  dbname --ignore-table=dbname.tablename --ignore-table=dbname.tablename2 --ignore-table=dbname.tablename3 > dump.sql


  2. 然后添加 –auto-repair 参数自动修复

    # mysqlcheck -u root -p daifans --auto-repair

Enter password:
daifans.wp_commentmeta
error    : Table upgrade required. Please do "REPAIR TABLE `wp_commentmeta`" or dump/reload to fix it!
daifans.wp_comments
error    : Table upgrade required. Please do "REPAIR TABLE `wp_comments`" or dump/reload to fix it!
daifans.wp_links
error    : Table upgrade required. Please do "REPAIR TABLE `wp_links`" or dump/reload to fix it!
daifans.wp_options
error    : Table upgrade required. Please do "REPAIR TABLE `wp_options`" or dump/reload to fix it!
daifans.wp_postmeta
error    : Table upgrade required. Please do "REPAIR TABLE `wp_postmeta`" or dump/reload to fix it!
daifans.wp_posts
error    : Table upgrade required. Please do "REPAIR TABLE `wp_posts`" or dump/reload to fix it!
daifans.wp_term_relationships                OK
daifans.wp_term_taxonomy
error    : Table upgrade required. Please do "REPAIR TABLE `wp_term_taxonomy`" or dump/reload to fix it!
daifans.wp_terms
error    : Table upgrade required. Please do "REPAIR TABLE `wp_terms`" or dump/reload to fix it!
daifans.wp_usermeta
error    : Table upgrade required. Please do "REPAIR TABLE `wp_usermeta`" or dump/reload to fix it!
daifans.wp_users
error    : Table upgrade required. Please do "REPAIR TABLE `wp_users`" or dump/reload to fix it!
Repairing tables
daifans.wp_commentmeta                       OK
daifans.wp_comments                          OK
daifans.wp_links                             OK
daifans.wp_options                           OK
daifans.wp_postmeta                          OK
daifans.wp_posts                             OK
daifans.wp_term_taxonomy                     OK
daifans.wp_terms                             OK
daifans.wp_usermeta                          OK
daifans.wp_users                             OK

    

-修复完之后就可以备份了

【mysql】 is marked as crashed and should be repaired