我可以在 rds 数据库中创建触发器吗? [英] Can I CREATE TRIGGER in an rds DB?

查看:48
本文介绍了我可以在 rds 数据库中创建触发器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 Amazon RDS 数据库中的表上创建触发器,但似乎无法实现.

I'm trying to create a trigger on a table in my Amazon RDS database, and I can't seem to make it happen.

我尝试在我使用的 mysql 客户端 (Navicat) 中的表上创建触发器,并收到错误消息,我需要 SUPER 权限才能这样做.经过一番搜索,我发现您可以 SET GLOBAL log_bin_trust_function_creators = 1 来解决这个问题.我尝试使用以下说明进行操作:http://getasysadmin.com/2011/06/amazon-rds-super-privileges/(然后重新启动数据库服务器以进行良好的测量),但没有运气.

I tried to create a trigger on a table in the mysql client I use (Navicat), and got the error that I needed the SUPER privilege to do so. After some searching, I found that you could SET GLOBAL log_bin_trust_function_creators = 1 to get around this. I tried that using these instructions: http://getasysadmin.com/2011/06/amazon-rds-super-privileges/ (and then restarting the DB server for good measure), but no luck.

我还尝试通过 mysql 命令行创建触发器和设置变量,以确保 Navicat 没有向我的 sql 命令添加任何不需要的东西,但也失败了.搜了一下好像也没有办法给自己SUPER权限.

I also tried creating the trigger and setting the variable via the mysql commmand line to make sure Navicat wasn't adding anything unwanted to my sql commands, but that failed, too. It also seems from searching that there's no way to grant yourself the SUPER privilege.

那么……是否可以在 RDS 中创建触发器?

So ... is creating a trigger possible in RDS?

推荐答案

不,这实际上并非不可能,只是需要太多额外的工作.

No it is actually not impossible it just takes far too much extra work.

首先似乎不可能将超级权限应用于默认参数组.所以我必须做的是通过控制台或 CLI 创建一个新的数据库参数组.

First off it seems to be impossible to apply Super Privileges to a default parameter group. So what I had to do was to create a new DB Parameter group either through the Console, or the CLI.

我发现,关键是默认区域不是我尝试使用的区域,因此我必须使用 --region 参数将其应用于我所在的正确区域中的组部署我的数据库实例

rds-create-db-parameter-group --db-parameter-group-name allow-triggers --description 'parameter group to allow triggers' --region your-region 

接下来我必须创建一个使用该参数组的数据库实例.(再次通过控制台或 CLI)

Next I had to create a DB Instance which used that parameter group. (Again through the console or CLI)

rds-create-db-instance

然后我不得不修改参数组以允许 log_bin_trust_function_creators 只能通过 CLI 完成

Then I had to modify the Parameter group to allow log_bin_trust_function_creators only accomplishable through the CLI

rds-modify-db-parameter-group --db-parameter-group-name yourgroupname --region yourRegion --parameters 'name=log_bin_trust_function_creators,value=true,method=immediate'

最后我不得不修改创建的数据库实例以允许触发器,也只允许 CLI.

Lastly I had to modify the created DB Instance to allow triggers, also CLI only.

rds-modify-db-instance --db-instance-identifier your-db-instance-id --db-parameter-group-name allow-triggers --apply-immediately

这篇关于我可以在 rds 数据库中创建触发器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆