MySQL連線超時相關的兩個引數interactive_timeout和wait_timeout的區別和解釋
先看看官方文件對於這兩個引數的定義
interactive_timeout
預設是28800,單位秒,即8個小時
The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the CLIENT_INTERACTIVE option to mysql_real_connect(). See also wait_timeout.
wait_timeout
預設同樣是28800s
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 interactive_timeout.
interactive_timeout針對互動式連線,wait_timeout針對非互動式連線。所謂的互動式連線,即在mysql_real_connect()函式中使用了CLIENT_INTERACTIVE選項。
說得直白一點,透過mysql客戶端連線資料庫是互動式連線,透過jdbc連線資料庫是非互動式連線。
interactive_timeout:互動式連線超時時間(mysql工具、mysqldump等)
wait_timeout:非互動式連線超時時間,預設的連線mysql api程式,jdbc連線資料庫等
在連線啟動的時候,根據連線的型別,來確認會話變數wait_timeout的值是繼承於全域性變數wait_timeout,還是interactive_timeout。
如何設定和檢視:
mysql> set global interactive_timeout=1800;
Query OK, 0 rows affected (0.00 sec)
mysql> set global wait_timeout=1800;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like 'interactive_timeout';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| interactive_timeout | 1800 |
+---------------------+-------+
1 row in set (0.00 sec)
mysql> show global variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 1800 |
+---------------+-------+
1 row in set (0.00 sec)
interactive_timeout
預設是28800,單位秒,即8個小時
The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the CLIENT_INTERACTIVE option to mysql_real_connect(). See also wait_timeout.
wait_timeout
預設同樣是28800s
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 interactive_timeout.
interactive_timeout針對互動式連線,wait_timeout針對非互動式連線。所謂的互動式連線,即在mysql_real_connect()函式中使用了CLIENT_INTERACTIVE選項。
說得直白一點,透過mysql客戶端連線資料庫是互動式連線,透過jdbc連線資料庫是非互動式連線。
interactive_timeout:互動式連線超時時間(mysql工具、mysqldump等)
wait_timeout:非互動式連線超時時間,預設的連線mysql api程式,jdbc連線資料庫等
在連線啟動的時候,根據連線的型別,來確認會話變數wait_timeout的值是繼承於全域性變數wait_timeout,還是interactive_timeout。
如何設定和檢視:
mysql> set global interactive_timeout=1800;
Query OK, 0 rows affected (0.00 sec)
mysql> set global wait_timeout=1800;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like 'interactive_timeout';
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| interactive_timeout | 1800 |
+---------------------+-------+
1 row in set (0.00 sec)
mysql> show global variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 1800 |
+---------------+-------+
1 row in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2133456/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL:引數wait_timeout和interactive_timeout以及空閒超時的實現MySqlAI
- Mysql引數解釋---wait_timeout、interactive_timeoutMySqlAI
- 【Mysql】MySQL中interactive_timeout和wait_timeout的區別MySqlAI
- interactive_timeout和wait_timeout引數區別和設定策略AI
- MySQL之wait_timeout和interactive_timeout引數MySqlAI
- MySQL 連線相關引數MySql
- mysql的wait_timeout和interactive_timeoutMySqlAI
- MYSQL連線相關引數和狀態值詳解MySql
- 【MySQL】淺析interactive_timeout和wait_timeoutMySqlAI
- MySQL slow log相關引數解釋MySql
- 幾個和MySQL InnoDB相關的引數設定說明MySql
- MySQL handler相關狀態引數解釋MySql
- MySQL的幾個和innodb相關的主要引數設定總結MySql
- mysql關於最大連線數、最大併發執行緒數的區別MySql執行緒
- mysql備份時候兩個很有用的引數MySql
- Oracle undo保留時間的幾個相關引數Oracle
- MySQL5.7統計資訊更新的相關引數解釋和測試MySql
- 【MYSQL】兩階段提交及相關引數介紹MySql
- MySQL效能相關引數MySql
- 等值連線和自然連線的區別
- Python 函式中引數前面一個和兩個星號(**)的區別Python函式
- oracle 連線數相關Oracle
- Springboot 連線池wait_timeout超時設定Spring BootAI
- MySQL的兩種filesort演算法介紹以及相關引數的設定和優化MySql演算法優化
- mysql 連線超慢的一個原因MySql
- MySQL slow log相關引數MySql
- oracle最大連線數相關Oracle
- Http 和TCP的關係,TCP長連線和短連線有什麼區別?HTTPTCP
- MySQL索引統計資訊更新相關的引數MySql索引
- SAP Spartacus 伺服器端渲染 timeout 和 forcedSsrTimeout 兩個引數的區別伺服器
- mysql innodb相關引數說明MySql
- 一個簡單的MySQL引數導致的連線問題解惑MySql
- 【mysql】關於連線mysql資料庫時出現的時區錯誤time zoneMySql資料庫
- MySQL環境變數裡關於字符集character_set相關引數的解釋MySql變數
- SHLVL 和 BASH_SUBSHELL 兩個變數的區別變數
- SQL Server中內連線和外連線的區別SQLServer
- 檢視mysql資料庫連線數、併發數相關資訊MySql資料庫
- 關於在執行java連線MongoDB時遇到的連線超時問題JavaMongoDB