MySQL implements batch checklist and repair and optimize _ MySQL

Source: Internet
Author: User
This article mainly introduces MySQL's methods of implementing batch checklist and repair and optimize, and analyzes the related techniques of MySQL batch repair and table optimization in the form of examples, for more information about how to implement a batch checklist and repair and optimize in MySQL, see the following example. We will share this with you for your reference. The details are as follows:

The following is the shell reference code:

#! /Bin/bashhost_name = 192.168.0.123user _ name = xiaomouser_pwd = my_pwd database = databases = truetables = $ (mysql-h $ host_name-u $ user_name-p $ user_pwd $ database-A-Bse" show tables ") for table_name in $ tablesdo check_result = $ (mysql-h $ host_name-u $ user_name-p $ user_pwd $ database-A-Bse "check table $ table_name" | awk '{print $4 }') if ["$ check_result" = "OK"] then echo "It's no need to repair table $ table_name" else echo $ (mysql-h $ host_name-u $ user_name-p $ user_pwd $ database-A-Bse "repair table $ table_name ") fi # optimization table, high performance if [$ need_optmize_table = true] then echo $ (mysql-h $ host_name-u $ user_name-p $ user_pwd $ database-A-Bse "optimize table $ table_name") fidone

You can also use the mysqlcheck command. this method can be used to check the table and automatically repair damaged tables, but this process is time-consuming.

The above is the MySQL method for implementing the batch checklist and repair and optimize _ MySQL content. For more information, please follow the PHP Chinese network (www.php1.cn )!

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.