information_schema.events 表保存了整个mysql实例中的event 信息

1、常用列:

  1、event_catalog                      :永远是def

  2、event_schema                      :event 所在的数据库名

  3、event_name                       :event 名

  4、definer                           :创建这个event 的用户

  5、event_definition                     :event 的内容

  6、event_type                        :event 的类型 one time 表示执行一次,RECURRING表示重复执行。

  7、status                           :event 的启用情况 enable | disable | slaveside_disable

2、例子:

创建一个event

delimiter go

create event if not exists event_insert
ON SCHEDULE EVERY 2 second
do
begin
insert into tempdb.events_table(insert_time) values(current_timestamp());
end
go delimiter ;

查看information_schema.events 的信息

mysql> select * from information_schema.events \G
*************************** 1. row ***************************
EVENT_CATALOG: def
EVENT_SCHEMA: tempdb
EVENT_NAME: event_insert
DEFINER: root@localhost
TIME_ZONE: SYSTEM
EVENT_BODY: SQL
EVENT_DEFINITION: begin
insert into tempdb.events_table(insert_time) values(current_timestamp());
end
EVENT_TYPE: RECURRING
EXECUTE_AT: NULL
INTERVAL_VALUE: 2
INTERVAL_FIELD: SECOND
SQL_MODE: STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
STARTS: 2016-08-25 22:12:20
ENDS: NULL
STATUS: ENABLED
ON_COMPLETION: NOT PRESERVE
CREATED: 2016-08-25 22:12:20
LAST_ALTERED: 2016-08-25 22:12:20
LAST_EXECUTED: 2016-08-25 22:25:12
EVENT_COMMENT:
ORIGINATOR: 1
CHARACTER_SET_CLIENT: utf8
COLLATION_CONNECTION: utf8_general_ci
DATABASE_COLLATION: utf8_general_ci
04-30 22:52