Mysql 事件管理

# 查看事件计划是否开启
SHOW VARIABLES LIKE 'event%';
SHOW VARIABLES LIKE 'event_scheduler';

#  开启事件计划
#  重启电脑自动开启事件计划 mysql.ini -> event_scheduler=ON
SET GLOBAL event_scheduler = ON;
SET @@global.event_scheduler = ON;
SET GLOBAL event_scheduler = 1;
SET @@global.event_scheduler = 1;

# 创建事件
DROP EVENT IF EXISTS event_persistent_interval_clean;
CREATE EVENT event_persistent_interval_clean
    ON SCHEDULE EVERY 1 DAY # 间隔一天
        STARTS DATE(CURDATE() + 1) # 今日24点
    DO
    BEGIN
        call procedure_persistent_pre_interval_clean;
    END;

你可能感兴趣的:(Database,Mysql,Database,存储过程)