关于mysql:mysql定时任务

42次阅读

共计 443 个字符,预计需要花费 2 分钟才能阅读完成。

查看定时工作
SELECT * FROM information_schema.events

敞开定时工作
DROP event wlzx_cosignorData_bak_clean_event;

执行 mysql 语句 DO 后是须要执行的 sql
每天凌晨 0 点执行
CREATE EVENT IF NOT EXISTS wlzx_cosignorData_bak_clean_event

ON SCHEDULE EVERY 1 DAY STARTS DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL 0 HOUR)     
ON COMPLETION PRESERVE ENABLE     
DO delete from liukl_wlzx_cosignorData_bak;  

每隔一分钟执行
CREATE event IF NOT EXISTS temp_event ON SCHEDULE EVERY 1 MINUTE
ON COMPLETION PRESERVE
DO update users set support=0 where support=1;

正文完
 0