MYSQL 定时任务

设置定时任务时,首先将event_scheduler设置为1,以开启事件计划功能。

1.开启功能
----------------------------------------
执行命令
set global event_scheduler=1;
select @@event_scheduler;
----------------------------------------
OR
---------------------------------------------------------------
修改文件
my.ini
# Set the event scheduler. 0 for OFF, 1 for ON.
event_scheduler=1
启动服务
---------------------------------------------------------------

2.创建计划
---------------------------------------------------------
CREATE DEFINER=`root`@`%`
EVENT `NewEvent`
ON SCHEDULE EVERY 1 DAY STARTS '2015-01-06 17:05:00'
ON COMPLETION NOT PRESERVE
ENABLE
DO
BEGIN
call Auto_Create_Partition('test','job');
call Auto_Create_Partition('test','page');
END;
----------------------------------------------------------

posted @ 2015-01-27 17:55  闫晓盼  阅读(948)  评论(0编辑  收藏  举报