Modify the parameter variable _ mysql without restarting MySQL

Source: Internet
Author: User
Modify the parameter variable bitsCN.com without restarting mysql.

Everyone on earth knows that updating mysql configuration requires restarting mysql to take effect. However, sometimes mysql is online and may not be allowed to be restarted. what should I do at this time?

Let's look at an example:

12345678910 mysql> show variables like 'log _ slave_updates '; + ------------------- + ------- + | Variable_name | Value | + ------------------- + ------- + | log_slave_updates | OFF | + ------------------- + ------- + 1 row in set (0.00 sec) mysql> set global log_slave_updates = 1; ERROR 1238 (HY000): Variable 'log _ slave_updates 'is a read only variable

See it? An error is reported!

Later, I checked the information and found that there was something called gdb, which was quite cool. I could change mysql parameters online. See the example below:

12345678 mysql> system gdb-p $ (pidof mysqld)-ex "set opt_log_slave_updates = 1"-batchmysql> show variables like 'log _ slave_updates '; + ------------------- + ------- + | Variable_name | Value | + ------------------- + ------- + | log_slave_updates | ON | + ----------------- + ------- + 1 row in set (0.00 sec)

But some repeated parameters cannot be changed directly with set. what should we do at this time? Foreigners gave a solution:

12345678910 mysql> show slave status/G... replicate_Do_DB: test... mysql> system gdb-p $ (pidof mysqld)-ex 'Call rpl_filter-> add_do_db (strdup ("hehehe") '-batchmysql> show slave status/G... replicate_Do_DB: test, hehehehe... bitsCN.com

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.