Search code examples
mysqlgoogle-cloud-platformgoogle-cloud-sql

Unable to create triggers in GCP cloud MySQL


I am trying to create triggers in cloud MySQL and facing the below error.

ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

Tried to set the global variable also but I getting superuser missing privileges.

SET GLOBAL log_bin_trust_function_creators = 1;

ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation

How to create the trigger in this case?


Solution

  • You will need to either use the Google Cloud Console GUI or the CLI gcloud to set database flags.

    Google Cloud Console GUI:

    • Open the Cloud SQL instance and click Edit.
    • Scroll down to the Flags section.
    • To set a flag that has not been set on the instance before, click Add item, - choose the flag from the drop-down menu, and set its value.
    • Click Save to save your changes. Confirm your changes under Flags on the Overview page.

    Using the CLI:

    gcloud sql instances patch [INSTANCE_NAME] \
      --database-flags log_bin_trust_function_creators=on