Report this

What is the reason for this report?

Default wait_timeout set to 8 hours?!!!

Posted on March 24, 2020
Vini

By Vini

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;

Results in…

Error Code: 1227
Access denied; you need (at least one of) the SUPER or SYSTEM_VARIABLES_ADMIN privilege(s) for this operation

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.