SyntaxStudy
Sign Up
MySQL Events and Replication
MySQL Advanced 4 min read

Events and Replication

Events in Replicated Environments

Events run on every server unless disabled on replicas. The ORIGINATOR field tracks which server created an event to avoid duplicate execution.

Example
-- Check event originator (server_id that created the event)
SELECT event_name, originator FROM information_schema.events;
-- On replica, disable all events:
SET GLOBAL event_scheduler = OFF;
-- Or disable specific event on replica after failover:
ALTER EVENT daily_cleanup ENABLE;   -- only on new primary
-- my.cnf approach (disable events globally on replicas):
-- event_scheduler = OFF
-- Only enable on the primary server
Pro Tip

After a failover, manually enable events on the new primary — do not run them on both simultaneously.