There are several parameters to set a timeout on MySQL :
But I would like to focus on wait_timeout (or interactive_timeout depending on how you connect)
This timeout allows MySQL to automatically close a connection in case of non-activity during the time defined by this parameter (default value is 28000 seconds).
The problem I wish to explain here may happen when this timeout is set to a low value (about 10 to 30 seconds).
Indeed, in this case, this timeout may have serious consequences,
look at that :
[The wait_timeout parameter is set to 10 seconds in this
case]
You are connected through the standard MySQL client and you need to run a delete query (bypass autocommit) :
- mysql> start transaction; …