Yashwanth Aluru
Yashwanth Aluru

Reputation: 1193

MySQL Connections in Sleep Mode after Timeout

I have a MySQL 5.7.16 running on a Centos 6. I read about these two configuration variables as,

interactive_timeout - interactive time out for mysql shell sessions in seconds like mysqldump or mysql command line tools.

wait_timeout - the amount of seconds during inactivity that MySQL will wait before it will close a connection on a non-interactive connection in seconds.

I set both these variables to 120 seconds in my server which means that after this time, both interactive (mysql shell) and non-interactive (like front end applications) should have their connections get disconnected automatically, if they are in "sleep" mode.

I observed some sessions from the application and other TCP/IP connections from different IDEs like MySQL Workbench running even after 120 seconds. Sometimes they go more than 200 seconds.

Are there any other settings I need to do in my configuration file?

Upvotes: 2

Views: 5891

Answers (1)

Did you set the GLOBAL variable to 120?

Use

SET GLOBAL wait_timeout = 120

insted

SET wait_timeout= 120

remember that value is refreshed only for new connections.

Run:

SELECT @@global.wait_timeout, @@session.wait_timeout;

to check the real value.

Upvotes: 5

Related Questions