mysql 事件

参考文章:http://www.cnblogs.com/c840136/articles/2388512.html

首先:确认事件机制开没开

show VARIABLES LIKE 'event_scheduler';

没开则SET GLOBAL event_scheduler = 1

也可以单独暂定或者启动一个事件 ALTER EVENT [event_name] ENABLE;

例子:#macc_sta_virtualip表定时删除

DROP EVENT

IF EXISTS macc_sta_virtualip_delete;

CREATE EVENT macc_sta_virtualip_delete ON SCHEDULE EVERY 1 DAY STARTS DATE_ADD(DATE_ADD(CURDATE(), INTERVAL 1 DAY), INTERVAL 3 HOUR) DO

DELETE FROM macc_sta_virtualip WHERE

TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP(), update_time)) >= 86400;

posted @ 2015-07-31 11:37  無限大  阅读(221)  评论(0编辑  收藏  举报