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'