使用GDB 修改MySQL参数不重启

 link:http://blog.chinaunix.net/uid-20785090-id-4016315.html

   mysql很多参数都需要重启才能生效,有时候条件不允许,可以使用gdb作为最后的手段

先看看修改之前

mysql> show global variables like '%connection%';
+--------------------------+-------------------+
| Variable_name            | Value             |
+--------------------------+-------------------+
| character_set_connection | latin1            |
| collation_connection     | latin1_swedish_ci |
| max_connections          | 151               |
| max_user_connections     | 0                 |
+--------------------------+-------------------+
4 rows in set (0.01 sec)


使用gdb来修改


[root@asm ~]# gdb -p $(pidof mysqld) -ex "set max_connections=1500" -batch

 其他的参数可以相应的修改


再查看当前的配置

mysql> show global variables like '%connection%';
+--------------------------+-------------------+
| Variable_name            | Value             |
+--------------------------+-------------------+
| character_set_connection | latin1            |
| collation_connection     | latin1_swedish_ci |
| max_connections          | 1500              |
| max_user_connections     | 0                 |
+--------------------------+-------------------+
4 rows in set (0.00 sec)

 可以看出修改成功了,不过使用gdb有风险,特别是生产环境,有可能导致进程down掉,仅作为最后手段使用.

原文地址:https://www.cnblogs.com/tangtianfly/p/3502127.html