无法在 Google 云中的 MySql table 上创建触发器
Can't create Trigger on MySql table within Google Cloud
CREATE TRIGGER trigger_LocationType_Insert
BEFORE UPDATE ON LocationType
FOR EACH ROW
SET NEW.NAME = ''
Returns 这个错误:
[HY000][1419] 您没有 SUPER 权限并且启用了二进制日志记录(您 *可能* 想使用不太安全的 log_bin_trust_function_creators 变量)
我知道这是因为即使是 root 用户 "has all privileges except SUPER and FILE."
https://cloud.google.com/sql/docs/mysql/users
而且我认为如果我可以 "Set log_bin_trust_function_creators to 1" 那么它就可以工作(该用户确实拥有 CREATE TRIGGER 权限)。但是,我在 Google Cloud SQL 控制台或 sql 语句中看不到如何做到这一点。
那么如何在这个环境中创建 TRIGGER?
此页面介绍了如何更改 Google 云实例的 MySQL 配置选项:https://cloud.google.com/sql/docs/mysql/flags
Select the instance to open its Instance Overview page.
The database flags that have been set are listed under the Database flags section.
您必须使用他们的 UI 来更改全局变量,因为没有 SUPER 权限您不能使用 SET GLOBAL
。
log_bin_trust_function_creators
选项列在支持的配置选项中,您可以在我上面链接的页面的 UI 中更改。
要详细了解此错误,请参阅 https://dev.mysql.com/doc/refman/5.7/en/stored-programs-logging.html
CREATE TRIGGER trigger_LocationType_Insert
BEFORE UPDATE ON LocationType
FOR EACH ROW
SET NEW.NAME = ''
Returns 这个错误:
[HY000][1419] 您没有 SUPER 权限并且启用了二进制日志记录(您 *可能* 想使用不太安全的 log_bin_trust_function_creators 变量)
我知道这是因为即使是 root 用户 "has all privileges except SUPER and FILE." https://cloud.google.com/sql/docs/mysql/users
而且我认为如果我可以 "Set log_bin_trust_function_creators to 1" 那么它就可以工作(该用户确实拥有 CREATE TRIGGER 权限)。但是,我在 Google Cloud SQL 控制台或 sql 语句中看不到如何做到这一点。
那么如何在这个环境中创建 TRIGGER?
此页面介绍了如何更改 Google 云实例的 MySQL 配置选项:https://cloud.google.com/sql/docs/mysql/flags
Select the instance to open its Instance Overview page.
The database flags that have been set are listed under the Database flags section.
您必须使用他们的 UI 来更改全局变量,因为没有 SUPER 权限您不能使用 SET GLOBAL
。
log_bin_trust_function_creators
选项列在支持的配置选项中,您可以在我上面链接的页面的 UI 中更改。
要详细了解此错误,请参阅 https://dev.mysql.com/doc/refman/5.7/en/stored-programs-logging.html