SHOW CREATE EVENT event_name
This statement displays the 此语句显示重新创建给定事件所需的CREATE EVENT
statement needed to re-create a given event. CREATE EVENT
语句。It requires the 它需要显示EVENT
privilege for the database from which the event is to be shown. EVENT
的数据库的事件权限。For example (using the same event 例如(使用第13.7.7.18节,“SHOW EVENTS语句”中定义并更改的相同事件e_daily
defined and then altered in Section 13.7.7.18, “SHOW EVENTS Statement”):e_daily
):
mysql> SHOW CREATE EVENT myschema.e_daily\G
*************************** 1. row ***************************
Event: e_daily
sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,
NO_ZERO_IN_DATE,NO_ZERO_DATE,
ERROR_FOR_DIVISION_BY_ZERO,
NO_ENGINE_SUBSTITUTION
time_zone: SYSTEM
Create Event: CREATE DEFINER=`jon`@`ghidora` EVENT `e_daily`
ON SCHEDULE EVERY 1 DAY
STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR
ON COMPLETION NOT PRESERVE
ENABLE
COMMENT 'Saves total number of sessions then
clears the table each day'
DO BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END
character_set_client: utf8mb4
collation_connection: utf8mb4_0900_ai_ci
Database Collation: utf8mb4_0900_ai_ci
character_set_client
is the session value of the 创建事件时character_set_client
system variable when the event was created. character_set_client
系统变量的会话值。collation_connection
is the session value of the collation_connection
system variable when the event was created. collation_connection
是创建事件时collation_connection
系统变量的会话值。Database Collation
is the collation of the database with which the event is associated.Database Collation
是与事件关联的数据库的排序规则。
The output reflects the current status of the event (输出反映事件(ENABLE
) rather than the status with which it was created.ENABLE
)的当前状态,而不是创建事件时的状态。