select @@event_scheduler; -- ON
show variables like 'event_scheduler';
Variable_name | Value |
---|---|
event_scheduler | ON |
-- DROP EVENT IF EXISTS sync_mtrols_hourly; CREATE DEFINER=`test`@`localhost` EVENT IF NOT EXISTS sync_mtrols_hourly ON SCHEDULE EVERY 1 HOUR ON COMPLETION NOT PRESERVE COMMENT 'sync matter_info roleids to matter_exam each hour.' DO UPDATE matter_exam me INNER JOIN matter_info mi ON me.id = mi.id SET me.role_ids = mi.role_ids WHERE mi.role_ids IS NOT NULL;
ALTER EVENT sync_mtrols_hourly ON SCHEDULE EVERY 1 DAY;
ALTER EVENT sync_mtrols_hourly DISABLE;
ALTER EVENT sync_mtrols_hourly ENABLE;
DROP EVENT IF EXISTS sync_mtrols_hourly;
SHOW EVENTS FROM test;
SHOW CREATE EVENT test.sync_mtrols_hourly ;
详解 MySQL 的计划任务
mysql事件计划自动_MySQL计划任务(事件调度器) Event Scheduler介绍
CREATE EVENT Statement
SHOW EVENTS Statement
SHOW CREATE EVENT Statement