เครื่อง Linux ทั่วไป
mysqlcheck -Aao --auto-repair --silent -u root -p
#ormysqlcheck -Aao --auto-repair --silent -u root --password=passdb
DirectAdmin + MySQL 5.0.67
/usr/local/mysql/bin/mysqlcheck -uda_admin -p`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2` -Aao --auto-repair
DirectAdmin + MySQL 5.5.9/usr/local/mysql/bin/mysqlcheck -uda_admin -p`grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2` -ro --auto-repair=TRUE --all-databases=TRUE
หรือจะใช้แบบนี้สำหรับเครื่องทั่วก็ได้mysqlcheck -u root -p -ro -–all-databases
คำอธิบายคำสั่ง mysqlcheck ในการ Optimize MySQL ทุก Databases คร่าวๆ
-a, -analyze [Analyze given tables]
-o, -optimize [Optimize table]
-A, -all-databases [Check all the database]
-auto-repair [If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found]
-r = Can fix almost anything except unique keys that are not unique.