SHOW EVENTS [{FROM | IN}schema_name
] [LIKE 'pattern
' | WHEREexpr
]
This statement displays information about Event Manager events, which are discussed in Section 25.4, “Using the Event Scheduler”. 此语句显示有关事件管理器事件的信息,这些信息在第25.4节,“使用事件调度器”中进行了讨论。It requires the 它要求显示事件的数据库具有EVENT
privilege for the database from which the events are to be shown.EVENT
权限。
In its simplest form, SHOW EVENTS
lists all of the events in the current schema:SHOW EVENTS
以其最简单的形式列出了当前模式中的所有事件:
mysql>SELECT CURRENT_USER(), SCHEMA();
+----------------+----------+ | CURRENT_USER() | SCHEMA() | +----------------+----------+ | jon@ghidora | myschema | +----------------+----------+ 1 row in set (0.00 sec) mysql>SHOW EVENTS\G
*************************** 1. row *************************** Db: myschema Name: e_daily Definer: jon@ghidora Time zone: SYSTEM Type: RECURRING Execute at: NULL Interval value: 1 Interval field: DAY Starts: 2018-08-08 11:06:34 Ends: NULL Status: ENABLED Originator: 1 character_set_client: utf8mb4 collation_connection: utf8mb4_0900_ai_ci Database Collation: utf8mb4_0900_ai_ci
To see events for a specific schema, use the 要查看特定架构的事件,请使用FROM
clause. For example, to see events for the test
schema, use the following statement:FROM
子句。例如,要查看test
模式的事件,请使用以下语句:
SHOW EVENTS FROM test;
The LIKE
clause, if present, indicates which event names to match. The WHERE
clause can be given to select rows using more general conditions, as discussed in Section 26.8, “Extensions to SHOW Statements”.LIKE
子句(如果存在)指示要匹配的事件名称。WHERE
子句可以用于使用更通用的条件来选择行,如第26.8节,“SHOW语句的扩展”所述。
SHOW EVENTS
output has these columns:输出具有以下列:
Db
The name of the schema (database) to which the event belongs.事件所属的架构(数据库)的名称。
Name
The name of the event.事件的名称。
Definer
The account of the user who created the event, in 创建事件的用户的帐户,格式为'
format.user_name
'@'host_name
''user_name'@'host_name'
。
Time zone
The event time zone, which is the time zone used for scheduling the event and that is in effect within the event as it executes. The default value is 事件时区,它是用于安排事件的时区,在事件执行时在事件内有效。默认值为SYSTEM
.SYSTEM
。
Type
The event repetition type, either 事件重复类型,ONE TIME
(transient) or RECURRING
(repeating).ONE TIME
(瞬态)或RECURRING
(重复)。
Execute At
For a one-time event, this is the DATETIME
value specified in the AT
clause of the CREATE EVENT
statement used to create the event, or of the last ALTER EVENT
statement that modified the event. The value shown in this column reflects the addition or subtraction of any INTERVAL
value included in the event's AT
clause. For example, if an event is created using ON SCHEDULE AT CURRENT_TIMESTAMP + '1:6' DAY_HOUR
, and the event was created at 2018-02-09 14:05:30, the value shown in this column would be '2018-02-10 20:05:30'
. If the event's timing is determined by an EVERY
clause instead of an AT
clause (that is, if the event is recurring), the value of this column is NULL
.
Interval Value间隔值
For a recurring event, the number of intervals to wait between event executions. 对于重复发生的事件,事件执行之间等待的间隔数。For a transient event, the value of this column is always 对于瞬态事件,此列的值始终为NULL
.NULL
。
Interval Field间隔字段
The time units used for the interval which a recurring event waits before repeating. For a transient event, the value of this column is always 用于重复事件在重复之前等待的时间间隔的时间单位。对于瞬态事件,此列的值始终为NULL
.NULL
。
Starts
The start date and time for a recurring event. 定期事件的开始日期和时间。This is displayed as a DATETIME
value, and is NULL
if no start date and time are defined for the event. For a transient event, this column is always NULL
. For a recurring event whose definition includes a STARTS
clause, this column contains the corresponding DATETIME
value. As with the Execute At
column, this value resolves any expressions used. If there is no STARTS
clause affecting the timing of the event, this column is NULL
Ends
For a recurring event whose definition includes a ENDS
clause, this column contains the corresponding DATETIME
value. As with the Execute At
column, this value resolves any expressions used. If there is no ENDS
clause affecting the timing of the event, this column is NULL
.
Status
The event status. One of ENABLED
, DISABLED
, or SLAVESIDE_DISABLED
. SLAVESIDE_DISABLED
indicates that the creation of the event occurred on another MySQL server acting as a replication source and replicated to the current MySQL server which is acting as a replica, but the event is not presently being executed on the replica. For more information, see Section 17.5.1.16, “Replication of Invoked Features”. information.有关更多信息,请参阅第17.5.1.16节,“调用功能的复制”。
Originator
The server ID of the MySQL server on which the event was created; used in replication. 创建事件的MySQL服务器的服务器ID;用于复制。This value may be updated by 如果在源服务器上执行,ALTER EVENT
to the server ID of the server on which that statement occurs, if executed on a source server. The default value is 0.ALTER EVENT
可以将此值更新为该语句所在服务器的服务器ID。默认值为0。
character_set_client
The session value of the 创建事件时character_set_client
system variable when the event was created.character_set_client
系统变量的会话值。
collation_connection
The session value of the collation_connection
system variable when the event was created.
Database Collation
The collation of the database with which the event is associated.
For more information about SLAVESIDE_DISABLED
and the Originator
column, see Section 17.5.1.16, “Replication of Invoked Features”.
Times displayed by SHOW EVENTS
are given in the event time zone, as discussed in Section 25.4.4, “Event Metadata”.
Event information is also available from the INFORMATION_SCHEMA
EVENTS
table. See Section 26.3.14, “The INFORMATION_SCHEMA EVENTS Table”.
The event action statement is not shown in the output of SHOW EVENTS
. Use SHOW CREATE EVENT
or the INFORMATION_SCHEMA
EVENTS
table.