MYSQL事宜檢查器應用引見。本站提示廣大學習愛好者:(MYSQL事宜檢查器應用引見)文章只能為提供參考,不一定能成為您想要的結果。以下是MYSQL事宜檢查器應用引見正文
要檢查以後能否已開啟事宜調劑器
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