Question

I can't seem to find any instructions or examples on how to set and persist MySQL configuration variables in Google's CloudSQL.

The specific problem I'm encountering is that interactive sessions hang around for 8 hours by default and, if I get disconnected from an interactive session the thread remains open and then update transactions block until I kill the thread.

The solution I found is this one:

set global interactive_timeout=300;

To terminate the interactive session after five minutes.

But that solution does not work because I get the error:

ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation

And adding super privileges fails like this:

mysql> GRANT SUPER ON *.* TO 'root'@'%' IDENTIFIED BY '<pwd>';
ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)

So it seems the root user of the Cloud SQL instance does not have sufficient privileges to set global variables.

Separately, I can't figure out how to persist that setting so that it will remain in place if the server is restarted.

I've looked at using:

gcloud sql instances patch

but it does not seem to have the ability to patch these settings.

Any help would be appreciated.

Was it helpful?

Solution

You can now set a limited number of flags on your instance, see this Google doc.

Unfortunately this does not include the interactive_timeout flag.


Original Answer

It is not possible to set global variables on Cloud SQL with either the Cloud Console or gcloud utility.

And Cloud SQL does not support granting SUPER privileges see the bottom of this page .

However in this similar question Google Cloud SQL max-allowed-packet a Googler has answered saying that you can email them at cloud-sql@google.com with the project and instance name and they can configure that settings for you, so they may be able to set interactive_timeout for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top