每天特定时间的 MySQL 事件调度程序

2021-11-20 00:00:00 events scheduler mysql

这是我的查询

CREATE EVENT
RESET ON SCHEDULE AT TIMESTAMP DO
UPDATE `ndic`.`students`
SET `status` = '0';  

如何将状态更新为0"?每天下午 1 点.

How can I update status to "0" at 1 pm every day.

我可以用什么代替 TIMESTAMP?

推荐答案

这对您的工作来说可能为时已晚,但我是这样做的.我希望每天凌晨 1 点运行一些东西 - 我相信这与您正在做的类似.我是这样做的:

This might be too late for your work, but here is how I did it. I want something run everyday at 1AM - I believe this is similar to what you are doing. Here is how I did it:

CREATE EVENT event_name
  ON SCHEDULE
    EVERY 1 DAY
    STARTS (TIMESTAMP(CURRENT_DATE) + INTERVAL 1 DAY + INTERVAL 1 HOUR)
  DO
    # Your awesome query

相关文章