1、首先检查event是否开启
SELECT @@event_scheduler;
2、如果没有开启,则需要开启--临时开启如下
SET GLOBAL event_scheduler = ON ;
SET @@ global .event_scheduler = ON ;
SET GLOBAL event_scheduler = 1; — 0代表关闭
SET @@ global .event_scheduler = 1;
3、创建even
CREATE EVENT deleteIllegalShipmentWarningTask1 ON SCHEDULE EVERY 60 SECOND DO DELETE FROM ec_task WHERE `name` = '违规出货预警任务'