当前位置: 数据库>mysql
MYSQL事件查看器使用介绍
来源: 互联网 发布时间:2014-10-04
本文导语: 要查看当前是否已开启事件调度器 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 s...
要查看当前是否已开启事件调度器
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`
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`