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.