mysql 定时器,定时删除几天后的数据
300秒执行一次,删除字段为time的超过3天的记录。
// An highlighted block
use xxx;
DELIMITER $$
DROP EVENT IF EXISTS deleteLog;
CREATE EVENT deleteLog
ON SCHEDULE EVERY 300 SECOND
ON COMPLETION PRESERVE
DO BEGIN
delete from hfc2.om_log where TO_DAYS(now())-TO_DAYS(time)>3;
END$$
DELIMITER ;