1390
MySQLerrorreplicationhigh confidence
Cannot change binary logging format inside a stored function or trigger
Production Risk
Low — statement fails; trigger/function not executed.
What this means
An attempt was made to change binlog_format inside a stored function or trigger, which is not permitted.
Why it happens
- 1SET SESSION binlog_format = STATEMENT inside a trigger or function
How to reproduce
trigger — this will error
trigger — this will error
CREATE TRIGGER t BEFORE INSERT ON orders FOR EACH ROW BEGIN SET SESSION binlog_format = 'STATEMENT'; END;
expected output
ERROR 1390 (HY000): Cannot change the binary logging format inside a stored function or trigger; statement format logging required
Fix
Change binlog_format outside routines
Change binlog_format outside routines
SET GLOBAL binlog_format = 'ROW';
Why this works
Change binlog_format before calling routines, not inside them.
Sources
Official documentation ↗
MySQL 8.0 — 1390 ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev