Modify parameter variable _mysql if Mysql does not reboot

Source: Internet
Author: User

Generally, updating the MySQL configuration my.cnf requires a restart of MySQL to take effect, but sometimes MySQL is on the line and does not necessarily allow you to reboot.

Look at an example:

mysql> show variables like ' log_slave_updates ';

+-------------------+-------+
| variable_name     | Value |
+-------------------+-------+
| log_slave_updates | off   |
+-------------------+-------+
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's an error!

Later checked the data, found that there is a thing called gdb, feel pretty cow x, you can achieve online change MySQL parameters, see examples:
mysql> system Gdb-p $ (pidof mysqld)-ex "Set Opt_log _slave_updates=1 "-batch
mysql> show variables like ' log_slave_updates ';
+-------------------+-------+
| variable_name     | Value |
+-------------------+-------+
| log_slave_updates | on    |
+-------------------+-------+
Row in Set (0.00 sec)
But in some repeatable parameters that cannot be changed directly with the set, what then? The foreigner gave a solution:

Copy Code code as follows:

Mysql> Show Slave status \g
...
Replicate_do_db:test
...
Mysql> system Gdb-p $ (pidof mysqld)
-ex ' Call rpl_filter->add_do_db (StrDup ("hehehe")) '-batch
Mysql> Show Slave status \g
...
Replicate_do_db:test,hehehe
...

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.