Mysqlcheck: table maintenance and repair procedure _ MySQL

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.