要获取事件的元数据:To obtain metadata about events:
查询
INFORMATION_SCHEMA数据库的EVENTS表。参见 第 28.3.14 节,“INFORMATION_SCHEMA EVENTS 表”。Query theEVENTStable of theINFORMATION_SCHEMAdatabase. See Section 28.3.14, “The INFORMATION_SCHEMA EVENTS Table”.使用
SHOW CREATE EVENT语句。参见 第 15.7.7.8 节,“SHOW CREATE EVENT 语句”。Use theSHOW CREATE EVENTstatement. See Section 15.7.7.8, “SHOW CREATE EVENT Statement”.使用
SHOW EVENTS语句。参见 第 15.7.7.19 节,“SHOW EVENTS 语句”。Use theSHOW EVENTSstatement. See Section 15.7.7.19, “SHOW EVENTS Statement”.
事件调度器时间表示Event Scheduler Time Representation
MySQL 中的每个会话都有一个会话时区 (STZ)。这是会话的 time_zone 值,该值在会话开始时从服务器的全局 time_zone 值初始化,但在会话期间可以更改。Each session in MySQL has a session time zone (STZ). This is the
session time_zone value that is
initialized from the server's global
time_zone value when the session
begins but may be changed during the session.
当执行 CREATE EVENT 或 ALTER EVENT 语句时的当前会话时区用于解释事件定义中指定的时间。这将成为事件时区 (ETZ);即用于事件调度并在事件执行期间生效的时区。The session time zone that is current when a
CREATE EVENT or
ALTER EVENT statement executes is
used to interpret times specified in the event definition. This
becomes the event time zone (ETZ); that is, the time zone that is
used for event scheduling and is in effect within the event as it
executes.
在数据字典中表示事件信息时,execute_at、starts 和 ends 时间会转换为 UTC 并与事件时区一起存储。这使得事件执行能够按定义进行,而不受服务器时区或夏令时影响的后续更改影响。last_executed 时间也以 UTC 存储。For representation of event information in the data dictionary,
the execute_at, starts, and
ends times are converted to UTC and stored
along with the event time zone. This enables event execution to
proceed as defined regardless of any subsequent changes to the
server time zone or daylight saving time effects. The
last_executed time is also stored in UTC.
事件时间可以通过从信息模式 EVENTS 表中选择或通过 SHOW EVENTS 获取,但它们会以 ETZ 或 STZ 值报告。下表总结了事件时间的表示方法。Event times can be obtained by selecting from the Information
Schema EVENTS table or from
SHOW EVENTS, but they are reported
as ETZ or STZ values. The following table summarizes
representation of event times.
| 价值Value | EVENTS 表EVENTS Table |
SHOW EVENTSSHOW EVENTS |
|---|---|---|
| 执行时间Execute at | ETZ | ETZ |
| 开始Starts | ETZ | ETZ |
| 结束Ends | ETZ | ETZ |
| 上次执行Last executed | ETZ | 不适用n/a |
| 创建时间Created | STZ | 不适用n/a |
| 最后修改Last altered | STZ | 不适用n/a |