mysql事件的开启和调用
1、检测事件是否开启 show variables like 'event_scheduler';
2.开启事件
set global event_scheduler = on;
3.创建一个存储过程
程序代码:
delimiter // create procedure test() begin update project set create_time = now(); end;
4.创建一个事件
create event if not exists e_test on schedule every 30 second on completion preserve do call test();
5.关闭或开启执行事件
alter event event_name on completion preserver [enable | disable]
6.删除事件
drop event event_name;