Here’s a one-liner that will check all tables in a database:
http://codeinthehole.com/writing/checking-all-mysql-tables/
1 2 3 |
mysql -p<password> -D<database> -B -e "SHOW TABLES" \ | awk '{print "CHECK TABLE "$1";"}' \ | mysql -p<password> -D<database> |
And here’s an article that shows the use of mysqlcheck:
http://www.thegeekstuff.com/2011/12/mysqlcheck/
mysqlcheck, unlike myisamchk, can be run when the mysql daemon is running
This command will check, repair and optimize all tables in all databases:
1 |
mysqlcheck --debug-info --auto-repair -c -o --all-databases |