标签:
SET GLOBAL event_scheduler=1; SET GLOBAL event_scheduler=ON;
SHOW VARIABLES LIKE ‘event_scheduler‘; SELECT @@event_scheduler;
CREATE EVENT [IF NOT EXISTS] event_name ON SCHEDULE schedule [ON COMPLETION [NOT] PRESERVE] [ENABLE | DISABLE] [COMMENT ‘comment‘] DO sql_statement; schedule: AT TIMESTAMP [+ INTERVAL INTERVAL] | EVERY INTERVAL [STARTS TIMESTAMP] [ENDS TIMESTAMP] INTERVAL: quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE | WEEK | SECOND | YEAR_MONTH
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 5 DAY
ON SCHEDULE AT TIMESTAMP ‘2012-03-07 12:00:00‘
ON SCHEDULE EVERY 1 DAY STARTS CURRENT_TIMESTAMP + INTERVAL 5 DAY ENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH
CREATE EVENT `NewEvent` ON SCHEDULE EVERY 1 MONTH STARTS ‘2012-04-01 00:00:00‘ ENDS ‘2100-01-01 00:00:00‘ ON COMPLETION PRESERVE ENABLE DO update tb_test set amount=100 where id=2;;
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 e_test DISABLE;
DROP EVENT [IF EXISTS] event_name
参考来源:
MySQL的事件调度器使用介绍
http://www.lai18.com/content/433742.html
标签:
原文地址:http://my.oschina.net/u/2321543/blog/470473