Search code examples
mysqldatabasedatabase-administrationmysql-5.5

MySQL wait_timeout global and session setting issue


In MySQL there are two values for some parameters:

1) For session.
2) For global.

We can check the values for such parameters like:

1) show variables like 'wait_timeout'
2) show global variables like 'wait_timeout'

Now it returns the values:
1) for session = 500
2) For global = 28800

I am able to change the variables by command:
set global wait_timeout=100 ;
set session wait_timeout= 200;

But when i logged in again i am getting the following values:
for session = 500
for global = 100.

It means global values retain and session not, which is absolutely correct. But my concern is how we can change the session variables then for all sessions ? Because global is not that values taken by each session in this case.


Solution

  • I got the exact description:

    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())

    In MySQL doc wait_timeout description