SHOW VARIABLES LIKE "%wait%"
Result: 28800
SET @@GLOBAL.wait_timeout=300
SHOW GLOBAL VARIABLES LIKE "%wait%"
Result: 300
SHOW SESSION VARIABLES LIKE "%wait%"
Result:28800
I am confused by the results. Why does the last query give Result:28800 ?
Your session status are set once you start a session, and by default, take the current GLOBAL value.
If you disconnected after you did SET @@GLOBAL.wait_timeout=300
, then subsequently reconnected, you'd see
SHOW SESSION VARIABLES LIKE "%wait%";
Result: 300
Similarly, at any time, if you did
mysql> SET session wait_timeout=300;
You'd get
mysql> SHOW SESSION VARIABLES LIKE 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 300 |
+---------------+-------+