SHOW [FULL] EVENTS [FROM schema_name
] [LIKE pattern
]
In its simplest form, SHOW EVENTS
lists all
of the events in the current schema for which the current user
is the definer:
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
Type: RECURRING
Execute at: NULL
Interval value: 10
Interval field: INTERVAL_SECOND
Starts: 0000-00-00 00:00:00
Ends: 0000-00-00 00:00:00
Status: ENABLED
1 row in set (0.01 sec)
The columns in the output of SHOW EVENTS
— which are similar to, but not identical to the columns
in the INFORMATION_SCHEMA.EVENTS
table
— are shown here:
Db
: The schema (database) on which the
event is defined.
Name
: The name of the event.
Definer
: The user account
(username
@hostname
)
which created the event.
Type
: One of the two values
ONE TIME
(transient) or
RECURRING
.
-
Execute At
: The date and time when a
transient event is set to execute. Shown as a
DATETIME
value.
For a recurring event, the value of this column is always
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
.
-
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
.
-
Starts
: The start date and time for a
recurring event. This is displayed as a
DATETIME
value, and defaults to
'0000-00-00 00:00:00'
if no start date
and time is defined for the event.
For a transient event, the value of this column is always
NULL
.
-
Ends
: The end date and time for a
recurring event. This is displayed as a
DATETIME
value, and defaults to
'0000-00-00 00:00:00'
if no end date
and time is defined for the event.
For a transient event, the value of this column is always
NULL
.
Status
: The event status. One of
ENABLED
or DISABLED
.
Note that the action statement is not shown in the output of
SHOW EVENTS
.
To see events for a different schema, you can use the
FROM
clause. For example, if the
test
schema had been selected in the
preceding example, the user could view his events on
myschema
using the following statement:
SHOW EVENTS FROM myschema;
You can filter the list returned by this statement on the
event name using LIKE
plus a pattern.
This statement was added in MySQL 5.1.6.
See also Section 23.20, “The INFORMATION_SCHEMA EVENTS
Table”.