CREATE PROCEDURE updateFakeViewTime ()
BEGIN
update t_site_news set fakeViewTime = fakeViewTime+200 where (fakeViewTime+viewTime)<1000;
END;
create event if not exists e_updateFakeViewTime
on schedule every 1 day starts '2016-11-13 00:00:00'
on completion preserve
do call updateFakeViewTime ();
关闭事件任务
alter event e_updateFakeViewTime ON COMPLETION PRESERVE DISABLE;
开户事件任务
alter event e_updateFakeViewTime ON COMPLETION PRESERVE ENABLE;
MySQL 5.1.6 之后,你可以直接使用类似于oralce job的mysql event
首先,检查一下你的MYSQL是否打开了这项功能。
show variables like '%sc%';
默认下是未打开的,你可以到 my.ini (windows)/ my.cnf (linux/unix) 参数文件中定义后重启mysqld
或者直接 set global event_scheduler=on;
mysql定时任务
最新推荐文章于 2024-08-14 23:11:00 发布