Home  >  Article  >  Database  >  mysqlcheck - MySQL table maintenance program

mysqlcheck - MySQL table maintenance program

PHPz
PHPzforward
2023-08-30 15:57:051034browse

mysqlcheck - MySQL 表维护程序

mysqlcheck client performs table maintenance. It checks, repairs, optimizes or analyzes tables. If the user uses the --databases or --all-databases option to process all tables in one or more databases, calling mysqlcheck will take a long time. The same is true for the MySQL upgrade process if it determines a table check is needed, since it handles tables the same way.

mysqlcheck Usage

  • The command mysqlcheck should be used when the mysqld server is running. This means users do not have to stop the server to perform table maintenance. It uses SQL statements such as CHECK TABLE, REPAIR TABLE, ANALYZE TABLE, and OPTIMIZE TABLE in a user-friendly manner.

  • It helps to determine which statements need to be used for the operation that needs to be performed. The statement is then sent to the server for execution.

Call mysqlcheck

Three ways to call mysqlcheck-

shell> mysqlcheck [options] db_name [tbl_name ...]
shell> mysqlcheck [options] --databases db_name ...
shell> mysqlcheck [options] --all-databases

Default behavior

The default behavior of mysqlcheck is that the check can pass Rename binaries to changed tables (--check). If the user has the default tool for repairing tables, they will need to make a copy of mysqlcheck named mysqlrepair. Otherwise, a mysqlcheck symbolic link named mysqlrepair needs to be created. If the user calls mysqlrepair, it repairs the table.

  • mysqlrepair: The default option is –repair.

  • mysqlanalyze: The default option is --analyze.

  • mysqloptimize: The default option is --optimize.

The above is the detailed content of mysqlcheck - MySQL table maintenance program. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete