mysqld data table error is marked as crashed and last (automatic?) repair solution

mysqld data sheet error is marked as crashed and last (automatic?) repair solution

This article will introduce you to our tips when repairing the tableError: Table \'./db_name/table_name\' is marked as crashed and last (automatic?) repair failedSolution.

MYSQLThere is a problem with the data sheet, prompt ▼

Error: Table './db_name/table_name' is marked as crashed and last (automatic?) repair failed

mysql_upgrade executes the following commands to check and repair tables and upgrade system tables ▼

mysqlcheck --all-databases --check-upgrade --auto-repair
  • The failure of the operation is irreversible and the database must be halted:
    service monit stop
    service mysqld stop
  • Enter the directory where the database is located:
    cd /var/lib/mysql/db_name/

Note: The mysql service must be stopped before the operation is repaired.

  • Repair single datasheet:
    myisamchk -r tablename.MYI
  • Fix all datasheets:
    myisamchk -r *.MYI
  • Safe Mode:
    myisamchk -r -v -o <table_name>
  • Force mode:
    myisamchk -r -v -f <table_name>

myisamchk usage

Note: Before using myisamchk, make sure that mysqld is not accessing the table to be checked.Better stop mysqld.

  1. (I.e.
    myisamchk –update-state -s *.myi

    , and check which index files have problems (may take a long time).

  2. The update-state option is only used when stopping mysqld. -s means to ignore some normal table listed information and only list errors.
  3. For each corrupted table, try
    myisamchk -r -q table_name

    This is the quick repair mode, which will automatically check whether the index table and the data table can be consistent.If it is consistent, it can be fixed.

  4. If quick-fix mode fails, consider:
    myisamchk -r table_name

    Inconsistent data and indexes are deleted, and indexes are rebuilt.

  5. If that fails, consider:
    myisamchk –safe-recover table_name

Operation example

The failure of the operation is irreversible and the database must be halted:

service monit stop
service mysqld stop
cd /var/lib/mysql/eloha_ufo
cd /var/lib/mysql/eloha_cwl

Fix all datasheets:

myisamchk -r *.MYI
myisamchk -r -v -f wp_postmeta.MYI
myisamchk -r -v -f wp_posts.MYI
myisamchk -r -v -f wp_options.MYI
myisamchk -r -v -f wp_itsec_log

This is much slower than -r, but handles situations that -r cannot.

myisamchk -r -f -o /var/lib/mysql/eloha_ufo/wp_postmeta.MYI

Here is the command for the full path to the database table:

myisamchk -r -f /var/lib/mysql/eloha_ufo/wp_postmeta.MYI
myisamchk -r -f /var/lib/mysql/eloha_ufo/wp_posts.MYI

Start the MYSQLD database:

service mysqld start
service mysqld restart

start upMONIT Monitor :

service monit restart
service monit start

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) The "mysqld data table error is marked as crashed and last (automatic?) repair solution" shared by you will be helpful to you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-176.html

Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!

🔔 Be the first to get the valuable "ChatGPT Content Marketing AI Tool Usage Guide" in the channel top directory! 🌟
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

scroll to top