v2-38f9f525e288ec462db348987ae1cf20_r.jpg
检查event事件是否开启
show variables like '%sche%';
如果Value值为OFF,则需要开启
set global event_scheduler=1;
在my.cnf中mysqld域增加:
event_scheduler = 1

通过调用存过实现:
CREATE PROCEDURE test ()
BEGIN
delete rows where expire_time<now()
END;

create event if not exists event_name
on schedule every 5 second
on completion preserve
do call test();

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code