Me:
Magento gives me this error: SQLSTATE[HY000]: General error: 1419 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), query was: CREATE TRIGGER trg_catalog_category_product_after_insert AFTER INSERT ON catalog_category_product FOR EACH ROW
. How can I make my user capable to create triggers?
AI:
That error means MySQL is refusing the trigger because binary logging is enabled and the server requires either the SUPER privilege or the server global log_bin_trust_function_creators=1 to allow creation of triggers/functions by non‑SUPER users.
You have three safe options (in order of preference):
1) Give the user the TRIGGER privilege (recommended first)
- This is required to create triggers at all:
mysql> GRANT TRIGGER ON your_db.* TO ‘magento_user’@’host’;
mysql> FLUSH PRIVILEGES; - Then retry. If the server’s binary logging policy still blocks the operation you’ll see the same 1419 error — proceed to option 2.
2) Allow function/trigger creators by setting log_bin_trust_function_creators=1
- Preferred if you cannot/should not grant SUPER. Set it in my.cnf/my.ini under [mysqld]:
[mysqld]
log_bin_trust_function_creators = 1
then restart MySQL. - You can also set it at runtime (needs SUPER):
mysql> SET GLOBAL log_bin_trust_function_creators = 1; - On managed services (RDS/Aurora) change the parameter group to set log_bin_trust_function_creators = 1 and reboot the DB instance.
3) (Not recommended) Grant SUPER to the user
- Gives broad privileges, avoid unless absolutely necessary and you trust the account:
mysql> GRANT SUPER ON . TO ‘magento_user’@’host’;
mysql> FLUSH PRIVILEGES;
Quick checks
- See current value:
mysql> SHOW GLOBAL VARIABLES LIKE ‘log_bin_trust_function_creators’; - See current grants:
mysql> SHOW GRANTS FOR ‘magento_user’@’host’;
Notes
- On hosted DBs (RDS) you cannot GRANT SUPER; use option 2 via parameter group.
- After making the change, retry the Magento operation that tried to create the trigger.
Leave a Reply