gpt4 book ai didi

mysql - 为什么 MySQL 5.7 Even Scheduler START 日期时间与 CREATE/ALTER EVENT START 时间不匹配?

转载 作者:行者123 更新时间:2023-11-29 02:12:24 25 4
gpt4 key购买 nike

创建事件后...

DELIMITER $$
CREATE DEFINER=`abc`@`localhost` EVENT `testEventYearly` ON SCHEDULE EVERY 1 YEAR STARTS '2018-01-01 00:00:00' ON COMPLETION PRESERVE ENABLE DO BEGIN
CALL `spTestEventYearly` ();
END$$

...我查看 mysql.event 表并看到 starts 值为 2018-01-01 06:00:00。我检查了服务器上的日期/时间,一切正常。为什么会有时间上的差异?它会在 06:00 还是 00:00 执行?

最佳答案

https://dev.mysql.com/doc/refman/5.7/en/create-event.html说:

Times in the ON SCHEDULE clause are interpreted using the current session time_zone value. This becomes the event time zone; that is, the time zone that is used for event scheduling and is in effect within the event as it executes. These times are converted to UTC and stored along with the event time zone in the mysql.event table. This enables event execution to proceed as defined regardless of any subsequent changes to the server time zone or daylight saving time effects.

(强调我的)

我推断你在美国中部时区。您在本地时区为 UTC -0600 时创建了事件,然后 mysql.event 中存储的值比 UTC 提前了 6 小时。

关于mysql - 为什么 MySQL 5.7 Even Scheduler START 日期时间与 CREATE/ALTER EVENT START 时间不匹配?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48158573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com