利用mysql event 实现秒级crontab

创建event
CREATE EVENT ossec_del_data
ON SCHEDULE
EVERY 5 SECOND
COMMENT 'delete data every 30 sencond'
DO
DELETE alert, data FROM alert LEFT JOIN data ON alert.id=data.id LEFT JOIN signature ON alert.rule_id=signature.rule_id LEFT JOIN location ON alert.location_id=location.id WHERE

alert.rule_id in (31106,5501,5502,533,31104,31105,5706,31153,5710);

查看enent
SHOW CREATE EVENT ossec_del_data;
修改时间间隔
ALTER EVENT ossec_del_data
   ON SCHEDULE EVERY 2 DAY;

临时关闭
ALTER EVENT ossec_del_data DISABLE;
开启
ALTER EVENT ossec_del_data ENABLE;
删除
DROP EVENT IF EXISTS ossec_del_data;