interactive_timeout

[mysqld]
interactive_timeout=20

 交互式连接

会话1

[[email protected] ~]# mysql -umysql -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.28-debug-log Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

会话2

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |    8 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |    9 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |    9 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   10 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   10 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   11 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.01 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   12 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   12 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   13 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   14 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   14 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.01 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   15 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   16 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   16 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   17 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   18 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   18 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   19 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+-------+-----------+------+---------+------+-------+-----------------------+
| Id | User  | Host      | db   | Command | Time | State | Info                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
|  8 | root  | localhost | NULL | Query   |    0 | init  | show full processlist |
| 10 | mysql | localhost | NULL | Sleep   |   20 |       | NULL                  |
+----+-------+-----------+------+---------+------+-------+-----------------------+
2 rows in set (0.00 sec)

mysql> show full processlist;
+----+------+-----------+------+---------+------+-------+-----------------------+
| Id | User | Host      | db   | Command | Time | State | Info                  |
+----+------+-----------+------+---------+------+-------+-----------------------+
|  8 | root | localhost | NULL | Query   |    0 | init  | show full processlist |
+----+------+-----------+------+---------+------+-------+-----------------------+
1 row in set (0.00 sec)

20秒钟后,会话1,退去
时间: 07-07

interactive_timeout的相关文章

MySQL : interactive_timeout v/s wait_timeout

Most of the database intensive applications are worring about the default values of these variables obviously. Developers used to inform me that they need to extend the wait_timeout value in order to complete the query execution. After some googling,

MySQL中的配置参数interactive_timeout和wait_timeout(可能导致过多sleep进程的两个参数)

1)interactive_timeout:参数含义:服务器关闭交互式连接前等待活动的秒数.交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端.参数默认值:28800秒(8小时) (2)wait_timeout:参数含义:服务器关闭非交互连接之前等待活动的秒数.在线程启动时,根据全局wait_timeout值或全局interactive_timeout值初始化会话wait_timeout值,取决于客户端类型(由mysql_real_

interactive_timeout和wait_timeout的关系

interactive_timeout = 28800 wait_timeout = 28800 #这两个参数默认都是28800s,即8个小时; interactive_timeout指的是mysql在关闭一个交互的连接之前所要等待的秒数 wait_timeout指的是mysql在关闭一个非交互的连接之前所要等待的秒数 通过mysql客户端连接数据库是交互式连接,通过jdbc连接数据库是非交互式连接 (1)session级别修改interactive_timeout=10,wait_timeou

lnmp脚本

#!/bin/bash#Function: Install LNMP#Author: wang#Date: 20170809 nginx_install(){useradd www -u 509 -s /bin/bash -mmkdir -p /opt/server/nginx/temp #Install the make GCCyum -y install gcc gcc-c++ automake autoconf libtool make #Installing PCRE library (

让那些mysql里睡觉的进程,悄悄的死去吧。

公司日本租用了阿里云机器 本身有网络延迟,有一台Linux服务器专门用来跑游戏服务,由于历史原因,加上玩家数量的剧增,导致经常出现大量的sleep进程: 沾上一个脚本用来杀掉sleep进程: while :   do     n=`mysql -uroot -pfuckdba  processlist | grep -i sleep | wc -l`     date=`date +%Y%m%d\[%H:%M:%S]`     echo $n        if [ "$n" -gt 

玩转mysql主从

++++++++++++++++++++++++ 在master上处理 ++++++++++++++++#1 配置文件中添加并保证唯一 server-id=1 log-bin=/var/lib/mysql/mysql-bin #2 重启 /etc/init.d/mysqld restart #3 建立用于同步的账号rep grant replication slave on *.* to 'rep'@'192.168.11.%' identified by '123456'; flush pri

自动安装MySQL脚本

在Linux 上安装MySQL单实例SHELL脚本 在CentOS 6.5环境测试通过 #!/bin/bash user=mysql group=mysql port=3306 basedir=/usr/local/mysql datadir=/data/mysql/mysql_${port}/data sourcefile=$1 mysqlprofile=/etc/my.cnf logfile=/tmp/mysqlinstall.log nowtime=`date '+%Y-%m-%d %H:

阿里云RDS-MYSQL数据库参数设置,K哥

2016.9.2 最近被阿里云的数据库要搞疯掉了 自打阿里云抽风,非要取消myisam引擎,都换成innodb 没事总是主备切换,也没有错误日志 一问客服就是物理机波动,擦,波动是什么???????? 服务器自己跳舞了吗 看了看参数设置,很多都不知道 这两天有时间自己搜索整理了下 发给大家,有需要的看看 我的服务器应用主要是WEB网站服务 有一些不懂的地方或者不对的地方,还请大牛不吝赐教! 回复在评论中就可以了,thank you 我是K哥 auto_increment_offset表示自增长字

linux上源码编译安装mysql-5.6.28

在 linux 上编译安装 mysql-5.6.28.tar.gz http://www.mysql.com/ mysql下载地址: http://www.mysql.com/downloads/mysql/#downloads mysql 官方网站文档: https://dev.mysql.com/doc/ 01.准备工作 yum install -y gcc gcc-c++ cmake make ncurses ncurses-devel bison 02.解压 tar zxf mysql-