事件调度器操作
查看事件调度器是否开启:ON 表示已开启。
show variables like '%event_scheduler%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| event_scheduler | ON |
+-----------------+-------+
开启和关闭事件调度器:
# 开启事件调度器
set global event_scheduler = ON;
# 关闭事件调度器
set global event_scheduler = OFF;
SHOW EVENTS;
SELECT EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STARTS, ENDS, STATUS
FROM information_schema.EVENTS
WHERE EVENT_SCHEMA = 'oa';
SELECT
EVENT_SCHEMA as 'Database',
EVENT_NAME as 'Event Name',
LAST_EXECUTED as 'Last Executed'
FROM
information_schema.EVENTS
WHERE
EVENT_SCHEMA = 'oa';