show variables like ‘%sche%’;

set global event_scheduler =1;

CREATE PROCEDURE test ()
BEGIN
update examinfo SET endtime = now() WHERE id = 14;
END;

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

关闭事件任务

alter event e_test ON
COMPLETION PRESERVE DISABLE;

开启事件任务

alter event e_test ON
COMPLETION PRESERVE ENABLE;

以上测试均成功,测试环境为mysql 5.4.2-beta-community mysql community server(GPL)

以上的相关内容就是对MySQL定时执行的介绍,望你能有所收获。

mysql 计划任务重启后消失

我们只要修改一配置即可

event_scheduler在mysql的config中设置为OFF有关。去mysql中将配置改为ON则就搞定了。

PHP调用MYSQL存储过程实例,MySQL带参数的存储过程小例子

http://database.51cto.com/art/201608/516661.htm

http://www.cnblogs.com/luowei/archive/2012/04/18/2456134.html

http://blog.csdn.net/woshixuye/article/details/8348180

https://www.cnblogs.com/chenpi/p/5136483.html

http://blog.sina.com.cn/s/blog_86fe5b440100wdyt.html

https://www.cnblogs.com/hwaggLee/p/5444339.html

https://www.cnblogs.com/firadio/p/5109346.html