语法:
DELIMITER $$
Create DEFINER=`root`@`localhost` EVENT `terminalcommandclean_event`
ON SCHEDULE //计划(这是你需要写的地方)
EVERY 1 DAY STARTS '2020-11-13 03:05:59'//每天的3点05分执行
DO BEGIN //begin...end相当于java中的main方法:call :存储过程名();
CALL terminalcommandclean();
END$$
DELIMITER ;
你可能需要的查询语句:
SHOW VARIABLES LIKE '%event_sche%';//定时任务是否: on状态
SET GLOBAL event_scheduler=1;//不是on状态 ==》设置为on状态
ALTER EVENT test ON COMPLETION PRESERVE ENABLE;//开启test 定时任务;
ALTER EVENT test ON COMPLETION PRESERVE DISABLE;//关闭test定时任务//查看所有事件属性
SELECT * FROM information_schema.EVENTS;//查看主要几个属性
SELECT event_name,event_definition,interval_value,interval_field,STATUS FROM information_schema.EVENTS;