赞
踩
SET GLOBAL event_scheduler = 1; -- 开启事件 event, 0 为关闭
CREATE EVENT IF NOT EXISTS temp_event1
ON SCHEDULE EVERY 1 DAY -- 周期一天
ON COMPLETION PRESERVE ENABLE
DO update filter_element_inf set used_day= used_day + 1;
CREATE event IF NOT EXISTS temp_event2
ON SCHEDULE EVERY 1 MINUTE
ON COMPLETION PRESERVE
DO update filter_element_inf set used_day= used_day + 1;
SHOW VARIABLES LIKE 'event_scheduler';
效果如下:
SELECT * FROM information_schema.events;
效果如下:
CREATE EVENT IF NOT EXISTS temp_event1
ON SCHEDULE EVERY 1 DAY STARTS DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL 1 HOUR)
ON COMPLETION PRESERVE ENABLE
DO update filter_element_inf set used_day= used_day + 1;
alter event temp_event on COMPLETION PRESERVE ENABLE/DISABLE;
效果如下:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。