北京司法考试办公室,严道信,玻璃杯吉他谱
要查看当前是否已开启事件调度器
show variables like 'event_scheduler';
开启事件查看器
set global event_scheduler = 1;
创建事件
语法:
create event [if not exists] event_name
on schedule schedule
[on completion [not] preserve]
[enable | disable]
[comment 'comment']
do sql_statement;
实例:
create event updateinfostatus
on schedule every 30 minute
do
update `jd_article` set `status` = 0 where `status` = 1 and `date` <= now( );
修改事件
语法:
alter event event_name
[on schedule schedule]
[rename to new_event_name]
[on completion [not] preserve]
[comment 'comment']
[enable | disable]
[do sql_statement]
实例:
alter event updateinfostatus
on schedule every 30 minute
do
update `jd_article` set `status` = 0 where `status` = 1 and `date` <= now( );
删除事件
drop events if exists updateinfostatus
临时关闭事件
alter events updateinfostatus disable
开启事件
alter events updateinfostatus enable
查看事件详细信息
select * from information_schema.events where event_name = 'updateinfostatus' and event_schema = 'jdwc'
查看所有事件
show events
查看事件创建信息
show create event updateinfostatus
作者 zhou hr
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
索引原理及B树索引
索引原理及B树索引 http://hongyitong.github.io/2017/01/05/%E7%B4%A2%E5%BC%95%E5%8E%9F...
[阅读全文]
-
-
-
-
MySQL的DML语言操作实例
补充说明,外键:不要使用外键,一切外键概念都在应用层解决。补充说明,数据库的列,也就是字段名,尽量带上飘符号`数据库存在的意义:数据存储和数据管理。数据库:行(...
[阅读全文]
-
-
-
-
-
网友评论