Questions about MySQL wait_timeout parameter settings not in effect

Source: Internet
Author: User

About Wait_timeout

Once went to online set wait_timeout when found changed does not take effect, as follows:

Mysql> Show variables like ' wait_timeout ';
+---------------+-------+
| variable_name | Value |
+---------------+-------+
| Wait_timeout | 100 |
+---------------+-------+
1 row in Set (0.00 sec)

mysql> set global wait_timeout=28800;
Query OK, 0 rows Affected (0.00 sec)

Mysql> exit
Bye

Log back in to MySQL after exiting
Mysql> Show variables like ' wait_timeout ';
+---------------+-------+
| variable_name | Value |
+---------------+-------+
| Wait_timeout | 100 |
+---------------+-------+
1 row in Set (0.00 sec)

Search the Internet for a moment:

The default values for 1:interactive_timeout and Wait_timeout are 28800 (8 hours) when the two parameters appear in the same time, the value of interactive_timeout will prevail. That is, no matter what the value of wait_timeout, use show variables like '%timeout% '; the two values shown are the same, and both are interactive_timeout values.

Myth 2: If the query is using show variables, you will find that the settings do not appear to be in effect, because the simple use of show variables is equivalent to using the show session variables, the query is session variables, Only the global variable is queried using show global variables. Many people on the web complain that they have not found a change after set global using Show variables query, because they confuse session variables and global variables, and if you just want to modify session variables, you can use a set wait_timeout=10 or set session wait_timeout=10; Such a grammar.

Verify the Argument 1: Modify the Interactive_timeout to achieve the effect of modifying wait_timeout

Mysql>Show variables like '%timeout ';
+-------------------------+-------+
| variable_name | Value |
+-------------------------+-------+
| Connect_timeout | 10 |
| Delayed_insert_timeout | 300 |
| interactive_timeout | 200 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Table_lock_wait_timeout | 50 |
| wait_timeout | 200 |
+-------------------------+-------+
8 rows in Set (0.00 sec)

Mysql> set global interactive_timeout=100;
Query OK, 0 rows Affected (0.00 sec)

Mysql>Show variables like '%timeout ';
+-------------------------+-------+
| variable_name | Value |
+-------------------------+-------+
| Connect_timeout | 10 |
| Delayed_insert_timeout | 300 |
| Interactive_timeout | 200 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Table_lock_wait_timeout | 50 |
| wait_timeout | 200 |
+-------------------------+-------+
8 rows in Set (0.00 sec)

Mysql>Show global variables like '%timeout ';
+-------------------------+-------+
| variable_name | Value |
+-------------------------+-------+
| Connect_timeout | 10 |
| Delayed_insert_timeout | 300 |
| interactive_timeout | 100 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Table_lock_wait_timeout | 50 |
| wait_timeout | 200 |
+-------------------------+-------+
8 rows in Set (0.00 sec)

Mysql> exit
Bye

Log back in to MySQL after exiting
Mysql>Show variables like '%timeout ';
+-------------------------+-------+
| variable_name | Value |
+-------------------------+-------+
| Connect_timeout | 10 |
| Delayed_insert_timeout | 300 |
| interactive_timeout | 100 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Table_lock_wait_timeout | 50 |
| wait_timeout | 100 |
+-------------------------+-------+
8 rows in Set (0.00 sec)

Mysql>

Above can be seen, if modify interactive_timeout words Wait_timeout will also follow change, and only modify wait_timeout is not effective.

Questions about MySQL wait_timeout parameter settings not in effect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.