您的位置:首页 > 数据库 > MySQL

使用GDB 修改MySQL参数不重启

2014-01-02 16:40 661 查看
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掉,仅作为最后手段使用.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: