如何在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 联系我们: