MySQL table is marked as crashed and last (automatic?) repair failed

前端 未结 9 1653
半阙折子戏
半阙折子戏 2021-01-29 18:01

I was repairing this table suddenly server hanged and when I returned back all tables are ok but this one showing \'in use\' and when I try to repair it doesn\'t proceed.

<
相关标签:
9条回答
  • If your MySQL process is running, stop it. On Debian:

    sudo service mysql stop
    

    Go to your data folder. On Debian:

    cd /var/lib/mysql/$DATABASE_NAME
    

    Try running:

    myisamchk -r $TABLE_NAME
    

    If that doesn't work, you can try:

    myisamchk -r -v -f $TABLE_NAME
    

    You can start your MySQL server again. On Debian:

    sudo service mysql start
    
    0 讨论(0)
  • 2021-01-29 18:15

    I needed to add USE_FRM to the repair statement to make it work.

    REPAIR TABLE <table_name> USE_FRM;
    
    0 讨论(0)
  • 2021-01-29 18:16

    Try running the following query:

    repair table <table_name>;
    

    I had the same issue and it solved me the problem.

    0 讨论(0)
  • 2021-01-29 18:17

    If it gives you permission denial while moving to /var/lib/mysql then use the following solution

    $ cd /var/lib/
    $ sudo -u mysql myisamchk -r -v -f mysql/<DB_NAME>/<TABLE_NAME>
    
    0 讨论(0)
  • 2021-01-29 18:18

    I got myisamchk: error: myisam_sort_buffer_size is too small as error.

    The solution

    myisamchk -r -v mysql/<DB_NAME>/<TABLE_NAME> --sort_buffer_size=2G
    
    0 讨论(0)
  • 2021-01-29 18:22

    If this happend to your XAMPP installation, just copy global_priv.MAD and global_priv.MAI files from ./xampp/mysql/backup/mysql/ to ./xampp/mysql/data/mysql/.

    0 讨论(0)
提交回复
热议问题