my.ini 最后一行加上
event_scheduler = 1
开启时间功能
show variables like 'event_scheduler';
set global event_scheduler = on;
DROP PROCEDURE edit_state;
delimiter $$;
create procedure edit_state()
BEGIN
update table1 set state=3 where end_date<NOW();
end
$$;
delimiter;
call edit_state();
second秒
create event `auto_edit_state`
on schedule every 1 day starts '2017-09-02 00:00:00'
on completion not preserve enable do call edit_state();
1,mysql.ini或者my.ini加上event_scheduler = 1
2,set global event_scheduler = on; 执行开启
3, 添加存储过程和事件任务计时