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,退去
时间: 2024-10-11 15:00:34

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

MySQL 的连接时长控制--interactive_timeout和wait_timeout

在用MySQL客户端对数据库进行操作时,如果一段时间没有操作,再次操作时,常常会报如下错误: ERROR 2013 (HY000): Lost connection to MySQL server during query ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... 这个报错信息就意味着当前的连接已经断开,需要重新建立连接. 那么,连接建立后,连接的时长是如何确定的呢?

mysql数据库配置wait_timeout和interactive_timeout总结

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

MySQL - wait_timeout与interactive_timeout详解

[1]分别是什么 ① interactive_timeout 官网说明如下:MySQL官网地址 MySQL服务器关闭交互式连接前等待的秒数.交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端.参数默认值:28800秒(8小时) ② wait_timeout MySQL服务器关闭非交互连接之前等待的秒数.在会话启动时,根据全局wait_timeout值或全局interactive_timeout值初始化会话wait_timeout值,

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