What is wait_timeout ?

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

If you set the wait_timeout variable for a session, it will valid for specific sessions only. But if you want to setup globally it will be valid for all the sessions.

Lets Begin with setting it up!

First make sure you are logged in to MySQL if not please login first. once logged enter this command


Expected response

mysql> SHOW SESSION VARIABLES LIKE "%wait_timeout%";
| Variable_name                      | Value    |
| innodb_lock_wait_timeout  | 50       |
| lock_wait_timeout                | 31536000 |
| wait_timeout                         | 28800    |
3 rows in set (0.00 sec)

Now do command

SET wait_timeout=30000;

Expected Response:

mysql> SET wait_timeout=30000; 
Query OK, 0 rows affected (0.00 sec)

In case you want to change globally then you have to follow the following steps find out more

1. Open the my indegenerique.be/.cnf file which resides in /etc/mysql directory.
2. Add below value with the mysqld blog to my.cnf file.

wait_timeout= 300000
interactive_timeout = 300000

Then restart MySQL by entering this command in the terminal

service mysql restart

You can confirm the changes by running this command again.


Good Luck!

(Visited 440 times, 1 visits today)