原文:https://www.4spaces.org/mysql-set-shedule/
MySQL开启定时任务的步骤如下:
1.检查event事件是否开启
show variables like '%sche%';
没开启的话,执行命令开启:
set global event_scheduler=1;
2.创建存储过程
创建一个名为update_leave_records
的存储过程。
CREATE PROCEDURE update_leave_records() UPDATE sys_leave_records AS t1,
sys_biz_process AS t2
SET t1.process_status = t2.process_status,
t1.remark = t2.remark,
t1.update_time = sysdate()
WHERE
t1.biz_id = t2.biz_id
AND t2.biz_id IN (
SELECT
p.biz_id
FROM
sys_biz_process AS p
LEFT JOIN sys_process_def AS d ON p.process_def_id = d.def_id
WHERE
d.def_type = 'ASK_FOR_LEAVE'
AND (
p.update_time > DATE_SUB( NOW(), INTERVAL 30 MINUTE )));
3.创建定时任务
CREATE EVENT
IF NOT EXISTS leave_monitor ON SCHEDULE EVERY 120 SECOND ON COMPLETION preserve
DO CALL update_leave_records();
4.查看定时任务
select * from mysql.event;
最新评论
网飞没问题, 迪士尼+有解决方案么?
pp助手是安卓手机用的,根本下载用不来苹果
已解决
这样的话数据库里的结构为{"attachment":{"content":"xxx"}}, 要怎么才能变成{"content":"xxx"},从而使结构保持一致?
赞! make test不过的坑都写到的,谢谢楼主~
谢谢你
用了root用户还是一直502是怎么回事呢
student id 是空的