1573
MySQLERRORNotableEventsHIGH confidence
Event scheduler: error setting variable
Production Risk
Medium — the event fires but may not complete its intended action.
What this means
The event scheduler encountered an error while trying to set a session variable for an event execution context.
Why it happens
- 1An event body attempts to SET a variable that is not accessible or read-only in the event execution context.
How to reproduce
trigger — this will error
trigger — this will error
-- Inside an event body: SET GLOBAL read_only = 1;
expected output
ERROR 1573 (HY000): Event scheduler: An error occurred while setting variables or calling the event.
Fix
Avoid setting restricted variables inside events
Avoid setting restricted variables inside events
-- Review event body and remove SET GLOBAL statements -- or adjust privileges for the event definer.
Why this works
Event executions run with the definer's privileges; only variables accessible to that user can be set.
Sources
Official documentation ↗
MySQL 8.0 — 1573 ER_EVENT_SET_VAR_ERROR
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev