Chinaunix

标题: show global variables和show variables得出的结果疑问 [打印本页]

作者: hxl    时间: 2016-06-23 11:00
标题: show global variables和show variables得出的结果疑问
root@host01 conf]# more /db/mysqlmha/conf/my.cnf
[mysqld]
server_id=1
log-bin=binlog
log-bin-index=binlog.index
port=3306
basedir=/db/mysqlmha
datadir=/db/mysqlmha/data
socket=/db/mysqlmha/mysql.sock
character-set-server=utf8
max_connections = 1500
show_compatibility_56=on
wait_timeout=600

配置文件里设置的wait_timeout为600


使用show global variables查出来的是600,说明这个是读取配置文件的
mysql> show global variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 600   |
+---------------+-------+
1 row in set (0.01 sec)

使用show variables查出来的是28800,请问这个值是从那里读取的呢? 我也想用show variables查出的值是600,需要怎么呢?
mysql> show  variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+
1 row in set (0.00 sec)
作者: seesea2517    时间: 2016-06-23 11:55
回复 1# hxl


参考:
    https://dev.mysql.com/doc/refman ... sysvar_wait_timeout
The number of seconds the server waits for activity on a noninteractive connection before closing it.

On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client (as defined by the CLIENT_INTERACTIVE connect option to mysql_real_connect()). See also c.


你 show variables 的时候是显示的当前的会话变量,两个不是同一个内容。具体没有深究,你试试看 interactive_timeout 这个配置调整看看。
作者: lyhabc    时间: 2016-06-23 17:42
一个global级别,一个session级别,当然不同
wait_timeout=100
interactive_timeout=100

connect_timeout = 20
slave-net-timeout=30




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2