Skip to content

Instantly share code, notes, and snippets.

@banago
Forked from francois-blanchard/mysqlcheck.md
Created February 13, 2016 10:48
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save banago/8b1230d7a4728699df44 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