Oracle is a registered trademark of Oracle Corporation and/or its…
This program can be used to CHECK (-c, -m, -C), REPAIR (-r), ANALYZE (-a),
or OPTIMIZE (-o) tables.
Some of the options (like -e or -q) can be
used at the same time.
Not all options are supported by all storage engines.
Please consult the MySQL manual for latest information about the
above.
The options -c, -r, -a, and -o are exclusive to each other, which
means that the last option will be used, if several was specified.
The option -c will be used by default, if none was specified. You
can change the default behavior by making a symbolic link, or
copying this file somewhere with another name, the alternatives are:
mysqlrepair: The default option will be -r
mysqlanalyze: The default option will be -a
mysqloptimize: The default option will be -o
Usage: ./mysqlcheck [OPTIONS] database [tables]
OR ./mysqlcheck [OPTIONS] --databases DB1 [DB2 DB3...]
OR ./mysqlcheck [OPTIONS] --all-databases
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf
The following groups are read: mysqlcheck client
The following options may be given as the first argument:
--print-defaults and exit.
--no-defaults from any option file.
--defaults-file=# Only from the #.
--defaults-extra-file=# after the global files are read.
-u, --user=name User for login if not current user.
-p, --password[=name] name is not given, it's solicited on the tty.
-h, --host=name
--tables Overrides option --databases (-B).
-B, --databases db db … Check several databases.
In this case no tables are given. All name arguments are database names.
-A, --all-databases Check, the same as --databases with all databases selected.
--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.
-1, --all-in-1 Instead of issuing one query for each table, use one query per database,
naming all tables in the database in a comma-separated list.
-c,
--check Check table for errors.
-C,
-F, --fast Check only tables that haven't been closed properly.
--check-only-changed since last check or haven't been closed properly.
-g, --check-upgrade Check tables for version-dependent changes.
May be used with --auto-repair to correct tables requiring version-dependent updates.
-m, --medium-check Faster than extended-check, but only finds 99.99 percent of all errors. good enough for most cases.
-e, --extended with CHECK TABLE, it will ensure that the table is 100 percent consistent,
but will take a long time.
with REPAIR TABLE, it will force using old slow repair with
keycache method, instead of much faster repair by sorting.
-q, --quick with CHECK TABLE, prevents scanning rows to check for wrong links.
This is the fastest check.
REPAIR TABLE, repair only the index tree. This is the fastest repair method for a table.
-r, --repair Can fix almost anything except unique keys that aren't unique.
--use-frm with REPAIR, get table structure from .frm
file, so the table can be repaired even if .MYI header is corrupted.
--fix-db-names
--fix-table-names
-a, --analyze Analyze given tables.
-o, --optimize Optimize table.
--compress Use compression in server/client protocol.
--debug-check Check memory and open file usage at exit.
--debug-info Print
--default-character-set=name
--default-auth=name Default authentication client-side plugin to use.
-f, --force Continue even if we get an SQL error.
--character-sets-dir=name Directory for character set files.
-P, --port=# 0 for default in order of preference, my.cnf, $MYSQL_TCP_PORT, /etc/services, built-in default (3306).
-S, --socket=name
--protocol=name tcp, socket, pipe, memory
--ssl Enable SSL for connection (automatically enabled with other flags).
--ssl-ca=name CA file in PEM format (check OpenSSL docs, implies --ssl).
--ssl-capath=name CA directory (check OpenSSL docs, implies --ssl).
--ssl-cipher=name SSL cipher to use (implies --ssl).
--ssl-cert=name X509 cert in PEM format (implies --ssl).
--ssl-key=name X509 key in PEM format (implies --ssl).
--ssl-verify-server-cert Verify server's "Common Name" in cert against hostname when connecting. disabled by default.
--plugin-dir=name Directory for client-side plugins.
-#, --debug[=#] This is a non-debug version. Catch this and exit.
-?, --help Display this help message and exit.
--write-binlog Log ANALYZE, OPTIMIZE and REPAIR TABLE commands.
Use --skip-write-binlog to disable when commands should not be sent to replication slaves.
Defaults to on
-v, --verbose Print info about the various stages.
-s, --silent Print only error messages.
-V, --version Output version information and exit.
Variables (--variable-name=value)
and boolean options {FALSE|TRUE} Value (after reading options)
--------------------------------- ----------------------------------------
all-databases FALSE
all-in-1 FALSE
auto-repair FALSE
character-sets-dir (No default value)
compress FALSE
databases FALSE
debug-check FALSE
debug-info FALSE
default-character-set (No default value)
default-auth (No default value)
fast FALSE
fix-db-names FALSE
fix-table-names FALSE
force FALSE
extended FALSE
host (No default value)
write-binlog TRUE
plugin-dir (No default value)
port 0
quick FALSE
silent FALSE
socket (No default value)
ssl FALSE
ssl-ca (No default value)
ssl-capath (No default value)
ssl-cert (No default value)
ssl-cipher (No default value)
ssl-key (No default value)
ssl-verify-server-cert FALSE
use-frm FALSE
user (No default value)