Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save giventofly/5ffb0abd13e6c17040c81a0a81b6477f to your computer and use it in GitHub Desktop.
Save giventofly/5ffb0abd13e6c17040c81a0a81b6477f to your computer and use it in GitHub Desktop.
fix mysql database error MySQL table is marked as crashed and last (automatic?) repair failed

//https://stackoverflow.com/questions/8843776/mysql-table-is-marked-as-crashed-and-last-automatic-repair-failed

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

I've got a myisam_sort_buffer_size is too small error, so this command worked for me: myisamchk -r -v --sort_buffer_size=2G <table_name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment