0

I'm running Windows, IIS, MySQL, PHP.

In my.ini under [mysqld] the value for wait_timeout is set to 60.

wait_timeout = 60 

But when I execute the following:

show variables like 'wait_timeout'; 

It shows me that the value is 28800, which I know is the default.

So I tried to set the value by executing the following:

SET GLOBAL wait_timeout = 60; 

But this doesn't seem to work. MySql Workbench tells me "0 rows(s) affected" and when I execute show variables like 'wait_timeout' it still tells me that the value is 28800.

I've also checked interactive_timeout and the story is the same. The value is 28800 and I can't change it.

What am I missing here?

3
  • Please check topic: stackoverflow.com/questions/22425463/… Commented Aug 27, 2021 at 15:40
  • 1
    When you want to know value of wait_timeout there are two distinct values. SHOW GLOBAL VARIABLES LIKE 'wait_timeout'; and SHOW SESSION VARIABLES LIKE 'wait_timeout'. SHOW VARIABLES LIKE 'wait_timeout' assumes you are wanting the session variable. wait_timeout controls inactivity timeout for usual processing, interactive_timeout controls idle time tolerance (seconds) when using MySQL Command Prompt for processing. When you want to SET SESSION wait_timeout; you need to immediately follow with the request you want to run because a new MySQL command prompt is another session. Commented Aug 29, 2021 at 13:57
  • 1
    Vince, Great to see you again on SF. Commented Aug 29, 2021 at 14:04

2 Answers 2

0

The answer is to set the value without the GLOBAL keyword.

SET wait_timeout = 60; 
0

GLOBAL setting are copied into your SESSION settings when you connect. Use either of these syntaxes:

SET @@... = ...; SET SESSION ... = ...; 

wait_timeout refers to how soon before you will be disconnected. Is that what you want?

Furthermore, there is some confusion over "batch" versus "interactive" timeout. Good look.

3
  • I was unable to get it to work with the "@@" but using the SESSION keyword was key! Thank you. Commented Aug 31, 2021 at 22:17
  • @Vincent - I do make mistakes. Fixed. Commented Oct 28, 2021 at 16:33
  • Sorry I changed my accepted answer. I was just reviewing this and realized that although your answer set me on the right path it was not the ultimate solution so I thought for future visitors it would be more helpful to highlight the correct solution with a green check mark. Commented Oct 29, 2021 at 17:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.