Mysql database optimization and restoration tools-MySQL

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

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.