Default wait_timeout set to 8 hours?!!!
After spinning up a 1vCPU / 1GB RAM / 10GB SSD MySQL managed database cluster, I’ve decided to check how the MySQL variables for the smallest version of this product were tuned.
This one caught my attention.
The following MySQL query shows the default wait_timeout variable.
show variables like 'wait%'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | wait_timeout | 28800 | +---------------+-------+
The resulting value is in seconds. So yes, by default MySQL is set to wait 8+ hours before it severs the cord!
This may be good if you have long-running queries and actually want to wait for them (but even then, eight hours is absurd!) but terrible in most cases.
When a query is run, this value is set to 0 (meaning forever), but generally, this should be set to a very low value (5 seconds, for example, or maybe even less) to free up the connection for other processes.
I propose DO change this default value to perhaps 60 at most in their small scale default MySQL database cluster setups such as the entry level ones.
At the time of this writing, the following MySQL query is not permitted.
SET GLOBAL wait_timeout = 60;
Error Code: 1227 Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×