1.首先先查看mysql是否开启定时任务开关
SHOW VARIABLES LIKE 'event_scheduler';
2.开关为off定时任务为关闭,开启任务开关
SET GLOBAL event_scheduler = ON;
3.创建事件
DELIMITER $$
DROP EVENT IF EXISTS name;
CREATE EVENT name
ON SCHEDULE EVERY 300 SECOND
ON COMPLETION PRESERVE
DO BEGIN
具体操作方法或者执行存储过程
END$$
DELIMITER ;