MySql创建事件、计划、定时运行

CREATE EVENT IF NOT EXISTS check_timeout_event
ON SCHEDULE EVERY 30 MINUTE
DO
BEGIN
UPDATE safetyApp_inspectionprogress
SET timeout = 1
WHERE status = 'unaccepted'
AND TIMESTAMPDIFF(HOUR, created_at, NOW()) > 24;
END;

 

 

查询计划功能是否打开:

SHOW VARIABLES LIKE 'event_scheduler'

posted @ 2024-02-17 19:11  侬侬发  阅读(21)  评论(0编辑  收藏  举报