Skip to content

Instantly share code, notes, and snippets.

@francois-blanchard
Last active July 26, 2020 16:23
Show Gist options
  • Save francois-blanchard/16b9379ae3f8a2fe8bd5 to your computer and use it in GitHub Desktop.
Save francois-blanchard/16b9379ae3f8a2fe8bd5 to your computer and use it in GitHub Desktop.
Check and Repair MySQL Tables Using Mysqlcheck

Check and Repair MySQL Tables Using Mysqlcheck

Check a Specific Table in a Database

$ mysqlcheck -c database_name table_name -u root -p

Check All Tables in a Database

$ mysqlcheck -c database_name  -u root -p

Check All Tables and All Databases

All
$ mysqlcheck -c  -u root -p --all-databases
Specific list data_bases
$ mysqlcheck -c  -u root -p --databases database_name_1 database_name_2

Analyze Tables using Mysqlcheck

$ mysqlcheck -a database_name table_name -u root -p

Optimize Tables using Mysqlcheck

$ mysqlcheck -o database_name table_name -u root -p

Repair Tables using Mysqlcheck

$ mysqlcheck -r database_name table_name -u root -p

Combine Check, Optimize, and Repair Tables

All
$ mysqlcheck -u root -p --auto-repair -c -o --all-databases
Specific database
$ mysqlcheck -u root -p --auto-repair -c -o database_name

Mode debug

$ mysqlcheck --debug-info -u root -p ...

Source : http://www.thegeekstuff.com/2011/12/mysqlcheck/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment