Mysql database optimization and restoration tool mysqlcheck details
1. Introduction to 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. Failure to fix myisamchk is irreversible.
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.
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:
Mysqlrepair
The default value is -- repair.
Mysqlanalyze
The default option is -- analyze.
Mysqloptimize
The default option is -- optimize.
II. Use of mysqlcheck
1. 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.
2. Fix all databases
Mysqlcheck-a-c-o-r-m -- all-databases-uroot-p
Use the above command to optimize all databases
Parameter meaning:
-A = Analyse given tables.
-C = Check table for errors
-O = Optimise table
-R = Can fix almost anything except t unique keys that aren't unique
-M = -- medium-check
Note: When the MYSQL version is 5.5, delete-o in the command.
3. fixed the specified database.
Mysqlcheck-o-r-uroot-p888888 dataname
Mysqlcheck-hlocalhost-auto-repair-uroot-p ****** dataname
4. here is a brief description of the usage of mysqlcheck.
Usage:
Mysqlcheck [OPTIONS] database [tables]
Mysqlcheck [OPTIONS]