7

I am trying to reproduce a connection timeout error by temporarily reducing the "wait_timeout" to 60 seconds instead of the default 28800 seconds.

I added wait_timeout=60 to the my.ini file and restarted MySql. Unfortunately, I am still not able to reproduce the error condition (unless i want to wait 28800 seconds).

The queries below seem to indicate the "wait_timeout" is set to 60 at the global variable level but still set at 28800 seconds for the regular variable (is that the same as the session variable?).

How can I correct this? How is the setting in the my.ini getting overwritten?

Thanks for any advice as I am still a bit of a MySql admin noob. :)

I'm running MySql 5.5.10 on Windows XP.

mysql> show variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show global variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 60    |
+---------------+-------+
1 row in set (0.00 sec)

1 Answer 1

7

From MySQL documentation: wait_timeout:

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.

You should also lower interactive_timeout global variable in your ini file.

Also note that:

This timeout applies only to TCP/IP and Unix socket file connections, not to connections made using named pipes, or shared memory.

(As Vladislav pointed the above note should be disregarded, as this bug has been fixed and the timeout applies to connections with named pipes or shared memory as well, but apparently the docs have not been updated.)

Sign up to request clarification or add additional context in comments.

3 Comments

thanks for the quick reply. i modified the interactive_timeout global variable in the my.ini file which did the trick
That timeout applies only to TCP and Unix domain sockets is outdated info, bug in the documentation. This was fixed back in 2009 (bugs.mysql.com/bug.php?id=31621)
@Vladislav: thnx, I didn't know that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.