Mysql定期任务(删除)

设定事件

create event event_name on schedule every 1 DAY starts now() ON COMPLETION PRESERVE ENABLE DO DELETE FROM database_name.table_name WHERE timestamp

执行事件
set global event_scheduler = on SHOW VARIABLES LIKE 'event_scheduler';

重启时间自动生效 【Mysql定期任务(删除)】在my.ini配置文件的[mysqld]部分加上event_scheduler=ON 即可

    推荐阅读