Event Scheduler应该每月执行一次 [英] Event Scheduler should execute every month
问题描述
我的计算机上安装了Win XP os和XAMPP.
I have Win XP os and XAMPP installed in my machine.
我需要在每个月的第一天上午12:00:00执行我的事件/调度程序. 表示每月1号. (例如1月1日,2月1日1月,3月1日...).
I need to execute my event/scheduler at 12:00:00 AM of First day of every month. Means 1st of every month. (e.g. jan 1st, Feb1 1st, March 1st, ... ).
然后 我还需要在同一事件中调用存储过程. 我想仅使用Event/Job来实现所有这些目的,而不是从前端开始.
And I also need to call the stored procedure in the same event. And I want achieve all this using Event/Job only not from front end.
请花几分钟时间进行查询.
Please spend few minutes for my query.
推荐答案
MySQL事件语法非常简单-
The MySQL event syntax is very simple -
DELIMITER $$
CREATE EVENT event1
ON SCHEDULE EVERY '1' MONTH
STARTS '2011-05-01 00:00:00'
DO
BEGIN
-- your code
END$$
DELIMITER ;
该事件将从"2011-05-01"的"00:00:00"开始(日期时间必须在将来).
Event will start working on '2011-05-01' at '00:00:00' (datetime must be in a future).
更多信息-使用事件计划程序
不要忘记启用全局事件调度线程-
Do not forget to enable global event scheduling thread -
SET GLOBAL event_scheduler = 1;
这篇关于Event Scheduler应该每月执行一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!