Backup and Restore performance_schema configuration in MySQL5.6

Source: Internet
Author: User
In mysql5.6, ce_schemaconfigures the 、setup.txt file, which is used to back up the performance_schema configuration. This script generates an SQL statement to restore the setup table in performance_schema. -- Backup setup_instrumentsselectconcat (updateperformance_schema.setup_instrumentssete

MySQL 5.6 backs up and restores the performance_schema configuration file, which is used to back up the performance_schema configuration. This script generates an SQL statement to restore the setup table in performance_schema. -- Backup setup_instrumentsselect concat ('Update performance_schema.setup_instruments set e

Back up and restore performance_schema configuration in MySQL 5.6
The one-stop setup.txt file is used to back up the configuration of performance_schema. This script generates an SQL statement to restore the setup table in performance_schema.

-- Backup setup_instrumentsselect concat ('Update performance_schema.setup_instruments set enabled = ''', enabled, ''' where name = ''', name ,''';') from performance_schema.setup_instruments where enabled = 'no'; -- backup setup_consumersselect concat ('Update replica set enabled = ''', enabled, ''' where name = ''', name, '''; ') from performance_schema.setup_consumers where enabled = 'no'; -- commitselect 'commit ;';



Run the setup.txt file to back up the cece_schema configuration.
mysql -h localhost -P 3306 -u root -pmysql -D test -s < d:\atmp\backup_perf_setup.sql > d:\ATMP\restore_perf_setup.sql


3. Enable all setup configurations for monitoring.
update performance_schema.setup_instruments set enabled='YES' where enabled='NO';update performance_schema.setup_consumers set enabled='YES' where enabled='NO';commit;


4. After the monitoring is complete, restore the cece_schema configuration.
D:\software\mysql\mysql-5.6.14-win32\bin>mysql -h localhost -P 3306 -u root -pmysql -D test -s < d:\ATMP\restore_perf_setup.sql


5. Clear the monitoring table records of performance_schema.
SELECT CONCAT('truncate table performance_schema.',table_name,';')FROM information_schema.TABLESWHERE table_schema='performance_schema'AND table_name NOT LIKE 'setup%'AND table_name NOT LIKE '%instances'AND table_name NOT LIKE '%attrs'AND table_name NOT IN ('performance_timers', 'threads');

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.