如何在CloudSQL中持久化MySQL配置变量?

[英]How do I persist MySQL configuration variables in CloudSQL?


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

我似乎找不到任何关于如何在谷歌的CloudSQL中设置和持久化MySQL配置变量的说明或示例。

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.

我遇到的具体问题是,交互式会话默认情况下会挂起8个小时,如果我从交互式会话断开连接,线程仍然是打开的,然后更新事务块,直到我终止线程。

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

错误1227(42000):访问被拒绝;您需要(至少一个)超级特权用于此操作。

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.

因此,似乎云SQL实例的根用户没有足够的权限来设置全局变量。

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.

如有任何帮助,我们将不胜感激。

1 个解决方案

#1


3  

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

现在,您可以在您的实例上设置有限数量的标志,查看这个谷歌doc。

Unfortunately this does not include the interactive_timeout flag.

不幸的是,这并不包括interactive_timeout标志。


Original Answer

原来的答案

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

不可能使用云控制台或gcloud实用程序在云SQL上设置全局变量。

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

云SQL不支持授予超权限,请参见本页的底部。

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.

但是,在这个类似的问题中,谷歌云SQL max-allow -packet,一个Google用户回答说,你可以在Cloud -sql@google.com发邮件给他们,告诉他们项目和实例名,他们可以为你配置这些设置,这样他们就可以为你设置interactive_timeout。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/04/06/c010dda7cab31a958e0b24e3eb5bc98f.html



 
  © 2014-2022 ITdaan.com 联系我们: