Skip to content

How do I turn on functions, procedures, and triggers for my Amazon RDS for MySQL DB instance?

3 minute read
0

I want to turn on functions, procedures, and triggers for my Amazon Relational Database Service (Amazon RDS) for MySQL DB instance.

Resolution

Amazon RDS is a managed service and doesn't provide system access (SUPERUSER privileges). If you turn on binary logging, then set log_bin_trust_function_creators to True in the custom database (DB) parameter group for your DB instance.

If you create a DB instance and don't specify a DB parameter group, then Amazon RDS creates a new default DB parameter group. For more information, see Overview of parameter groups.

To turn on functions, procedures, and triggers for Amazon RDS for MySQL DB instances, complete the following steps:

  1. Create a DB parameter group.
  2. Modify the custom DB parameter group, and then set the log_bin_trust_function_creators value to 1.
    Note: When you set log_bin_trust_function_creators=1, Amazon RDS might write unsafe events to the binary log. Binary logging is statement based and looks similar to the following example: (binlog_format=STATEMENT).
  3. Choose Save changes.
    Note: Before you use the DB parameter group with a DB instance, wait at least 5 minutes.
  4. In the navigation pane, choose Databases.
  5. Select the DB instance that you want to associate with the DB parameter group.
  6. Choose Modify.
  7. Select the parameter group that you want to associate with the DB instance.
  8. Reboot the DB instance.
    Note: The parameter group name immediately changes. Amazon RDS applies the parameter group changes after you reboot the instance without failover.

If you already use a custom parameter group, then complete only steps 2 and 3. The parameter log_bin_trust_function_creators is a dynamic parameter that doesn't require a DB reboot.

If you turn on automated backup for a MySQL DB instance, then you also turn on binary logging. If you create a trigger, then you might receive the following error message:

"ERROR 1419 (HY000): You don't have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)"

If you receive this error, then review the log_bin_trust_function_creators parameter. If the parameter isn't set to 1, then update the value to 1. If the parameter is set to 1 and you still get Access denied errors, then see How can I resolve 1227 and definer errors when importing data to my Amazon RDS for MySQL DB instance using mysqldump?

For more details about the parameter log_bin_trust_function_creators, see log_bin_trust_function_creators and Stored program binary logging on the MySQL website.

Related information

Working with DB cluster parameter groups for Multi-AZ DB clusters

7 Comments

Hi, Just the reboot was not helping me! I stopped and started the Database, then the new parameter group was applied. Thank you.

replied 3 years ago

I had to remove the DEFINER from the CREATE code. Changing the parameter and rebooting (even with a stop & start) did not help at all.

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
EXPERT
replied 2 years ago

Hello, what about RDS for PostgreSQL, I can't find topics and the parameters related to it.

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR
replied 2 years ago

Running into this issue and setting the parameter log_bin_trust_function_creators to 1 doesn't seem to help. Rebooting the RDS didn't helped either.

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR
replied 2 years ago