1. Create an event
DELIMITER $$ #Create
an event that allocates orders regularly
CREATE event jobOrderSplit #Open
timing
ON SCHEDULE #Run
once every 3 minutes
EVERY 3 MINUTE #Every day
at 9:10, once every 3 minutes
STARTS '2015-09-23 09:10 :00'
DO
BEGIN #Call
the stored procedure of automatic splitting
CALL automaticSplitting();
END;
DELIMITER;
2. Start the event
#Set startup global variables
set global event_scheduler=1/ON;
#Start a single event
ALTER EVENT eventName ON COMPLETION PRESERVE ENABLE;
3. Stop event
#Set the closed global variable
set global event_scheduler=0/OFF;
#Start a single event
ALTER EVENT eventName ON COMPLETION PRESERVE DISABLE;
Another: If all variables of the event are closed, even if a single event is opened, it will not be executed
Check whether the mysql global variable event is turned ON: ON OFF: OFF
SHOW VARIABLES LIKE 'event_scheduler';