mysqlcheck – a table maintenance and repair program
mysqlcheck must be used when the mysqld server is running, whereas myisamchk (similar in function to mysqlcheck) should be used when it is not. The benefit of using mysqlcheck is that you do not have to stop the mysql server to check or repair your tables.
mysqlcheck uses the SQL statements like CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE depend on the mysqlcheck options.
There are three general ways to invoke mysqlcheck:
#mysqlcheck [options] db_name [tables]
#mysqlcheck [options] –databases DB1 [DB2 DB3...]
#mysqlcheck [options] –all-databases
If you do not name any tables or use the –databases or –all-databases option, entire databases are checked.
mysqlcheck Option Reference:
–analyze, -a
Analyze the tables
–all-databases, -A
Check all tables in all databases. This is the same as using the
–databases option and naming all the databases on the command line
–check, -c
Check the tables for errors.
–check-only-changed, -C
Check only tables that have changed since the last check or that
have not been closed properly
–quick, -q
If you are using this option to check tables, it prevents the check
from scanning the rows to check for incorrect links. This is the
fastest check method.
If you are using this option to repair tables, it tries to repair
only the index tree. This is the fastest repair method
–fast, -F
Check only tables that have not been closed properly
–extended, -e
If you are using this option to check tables, it ensures that they
are 100% consistent but takes a long time
If you are using this option to repair tables, it runs an extended
repair that may not only take a long time to execute, but may
produce a lot of garbage rows also!
–optimize, -o
Optimize the tables
–force, -f
Continue even if an SQL error occurs
–repair, -r
Perform a repair that can fix almost anything except unique keys
that are not unique.
–auto-repair
If a checked table is corrupted, automatically fix it. Any necessary repairs are done after all tables have been checked
No comments:
Post a Comment