mysqlcheck
mysqlcheck [options]database[table]
This utility checks, repairs, and optimizes MyISAM tables. It
works in part on tables for other storage engines as well. It uses the
ANALYZE TABLE, CHECK TABLE,
OPTIMIZE TABLE, and REPAIR TABLE
statements. Therefore, if the storage engine supports any of these
statements, the operations that can be performed by supported statements
can be done using this utility. For MyISAM tables, this utility is
similar in use and purpose to myisamchk. Instead of working with the
table files directly as myisamchk does, though, this
utility interacts with the MySQL server.
The name of the database containing the tables to check is given as the second argument to the utility. The table to check is given as the third argument. Additional tables may be given in a space-separated list.
Here is a list of options that you can give and a brief explanation of each:
--all-databases,
-AThis option checks all databases.
--all-in-1, -1This option executes all queries for all tables in each database in one statement rather than as separate queries for each table.
--analyze, -aThis option analyzes tables.
--auto-repairThis option automatically repairs any corrupted tables found.
--character-sets-dir=pathThis option specifies the directory containing character sets.
--check, -cThis option checks tables for errors.
--check-only-changed,
-CThis option checks only tables that have changed since the last check, as well as tables that were not closed properly.
--compressThis option compresses data passed between the utility and the server, if compression is supported.
--databases
databases, -B
databasesThis option specifies more than one database for checking.
To specify tables along with databases with this option, use the
--tables option.
--debug[=options],
-# [options]This option logs debugging information. The set of options
used by default is 'd:t:o,logname'. See Table 16-1 at the end of the list of
options under the mysqldump utility for an
explanation of these flags and others that may be used.
--debug-checkThis option writes debugging information to the log when the utility ends. It’s available as of version 5.1.21 of MySQL.
--debug-infoThis option writes debugging information and CPU and memory usage information to the log after the utility ends.
--default-character-set=setThis option specifies the default character set. Enter
SHOW CHARACTER SET; on the server for a list of
character sets available.
--extended, -eThis option ensures consistency of data when checking tables. When repairing tables with this option, the utility will attempt to recover all rows, including intentionally deleted ones.
--fast, -FThis option checks only tables that were improperly closed.
--fix-db-namesThis option converts the names of databases that contain characters no longer permitted by MySQL as of version 5.1. It’s available as of version 5.1.7 of MySQL.
--fix-table-namesThis option converts the names of tables that contain characters no longer permitted by MySQL as of version 5.1. It’s available as of version 5.1.7.
--force, -fThis option forces processing of tables regardless of SQL errors encountered.
--help, -?This option displays basic help information.
--host=host, -h
hostThis option specifies the name or IP address of the server for connection.
--medium-check,
-mThis option is more thorough than --check
but less thorough than --extended.
--optimize, -oThis option optimizes tables.
--password[=password],
-p[password]This option provides the password to pass to the server. A
space is not permitted after -p if the password
is given.
--port=port,
-P portThis option specifies the port to use for connecting to the server. The default is 3306.
--protocol=protocolThis option specifies the protocol to use when connecting to
the server. The choices are TCP,
SOCKET, PIPE, and
MEMORY.
--quick, -qThis option checks tables faster by not scanning rows for incorrect links. When used to repair tables, it has the utility repair only the index tree. This option is the fastest method.
--repair, -rThis option repairs tables. Note that it can’t repair unique keys containing duplicates.
--silent, -sThis option suppresses all messages except for error messages.
--socket=filename,
-S filenameThis option provides the name of the server’s socket file.
--sslThis option specifies that secure SSL connections should be
used. It requires the server to have SSL enabled. If this option
is enabled on the utility by default, use --skip-ssl to disable it.
--ssl-ca=pem_fileThis option specifies the name of the file (i.e., the pem file) containing a list of trusted SSL CAs.
--ssl-capath=pathThis option specifies the path to the trusted certificates file (i.e., the pem file).
--ssl-cert=filenameThis option specifies the name of the SSL certificate file to use for SSL connections.
--ssl-cipher=ciphersThis option gives a list of ciphers that may be used for SSL encryption.
--ssl-key=filenameThis option specifies the SSL key file to use for secure connections.
--ssl-verify-server-certThis option verifies the client’s certificate against the server’s certificate for the client at startup. It is available as of version 5.1.11 of MySQL.
--tablesThis option specifies table names when using the
--databases option.
--use-frmThis option uses the table structure in the .frm file for repairing a corrupted index.
--user=user,
-u userThis option specifies the username for connecting to the server.
--verbose, -vThis option displays more information.
--version, -VThis option displays the version of the utility.