Mysqlcheck: the mysqlcheck client can check and repair the MyISAM table. It can also be optimized and analyzed.
The function of mysqlcheck is similar to that of myisamchk, but it works differently. The main difference is that mysqlcheck must be used when the mysqld server is running, while myisamchk is used when the server is not running. The advantage of using mysqlcheck is that you do not need to stop the server to check or repair tables.
Mysqlcheck provides a convenient way to use SQL statements such as CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE. It determines which statement is used in the operation to be executed, and then sends the statement to the server to be executed.
There are three methods to call mysqlcheck:
Shell> mysqlcheck [options] db_name [tables]
Shell> mysqlcheck [options] --- database DB1 [DB2 DB3. ..]
Shell> mysqlcheck [options] -- all -- database
If no table is specified or the --- database or -- all -- database option is used, check the entire database.
Compared with other clients, mysqlcheck has a special feature. Renaming the binary can change the default behavior of the checklist (-- check ). If you want a tool that can repair tables by default, you only need to copy mysqlcheck to mysqlrepair again, or use a symbol to link mysqlrepair to mysqlcheck. If you call mysqlrepair, follow the command to repair the table.
The following name can be used to change the default behavior of mysqlcheck:
The default mysqlrepair option is -- repair.
The default mysqlanalyze option is -- analyze.
The default mysqloptimize option is -- optimize.
Mysqlcheck
The following options are supported:
? --- Help ,-?
Displays the help message and exits.
? -- All -- database,-
Check all tables in all databases. Like using the --- database option, name all databases in the command line.
? -- All-in-1,-1
Instead of issuing a statement for each table, a statement is executed for each database of all tables to be processed in the named database.
? -- Analyze,-
Analysis Table.
? -- Auto-repair