MySQL check command in Linux

Source: Internet
Author: User

The mysqlcheck client tool can check and repair MyISAM tables, and optimize and analyze tables.

In fact, it integrates the functions of check, repair, analyze, and optimize in mysql,

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.

Option has the following common options:

-C, -- check (checklist );

-R, -- repair (repair table );

-A, -- analyze (analysis table );

-O, -- optimize (optimize table); // among them, the default option is-c (Check table)

Example:

Checklist (check );

Mysqlcheck-u root-c test

Repair table (repair );

Mysqlcheck-u root-r test

Fix a specified database

# Mysqlcheck-A-o-r Database_NAME-p

Check and repair all databases (tables;

# Mysqlcheck-u root-A-0-r-p

Automatically optimize MySQL databases on a daily basis

Crontab-e // Add it to the cron job and automatically execute it at every day.

0 1 *** mysqlcheck-Aao-auto-repair-u your username-p your password>/dev/null 2> & 1

Related Article

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.