MySQL timer is enabled and call to CREATE test TABLE www.2cto.com 1 create table t2 (3 v VARCHAR (100) NOT NULL4) engine innodb default charset = utf8; CREATE a timer to call the Stored PROCEDURE 1 DELIMITER $2 drop procedure if exists e_test $3 create procedure e_test () 4 BEGIN5 insert into t VALUES ('1 '); 6 END $7 DELIMITER; the constant GLOBAL event_scheduler for timing MySQL must be on or 1 -- check whether the timer 1 show variables like '% sche %' is enabled '; -- enable the timer 0: off 1: on 1 set global event_scheduler = 1; -- creates an event -- automatically calls e_test () every second () stored Procedure 1 create event if not exists event_test2ON schedule every 1 SECOND3ON completion preserve 4DO CALL e_test (); -- enable event 1 alter event event_test ON 2 completion preserve enable; -- disable event 1 alter event event_test ON 2 completion preserve disable; from now on, execute 1 create event EVENT1 2ON schedule every 9 day starts now () 3ON completion preserve enable 4DO5 BEGIN 6 call total (); 7. Run 1 create event EVENT2 2ON schedule every 1 month starts DATE_ADD (DATE_SUB (CURDATE (), interval day (CURDATE () at each MONTH at END 1 ()) -1 DAY), INTERVAL 1 MONTH), INTERVAL 1 HOUR) 3ON completion preserve enable 4DO 5 BEGIN 6 call stat (); 7 END: 1 create event TOTAL_SEASON_EVENT 2ON schedule every 1 quarter starts DATE_ADD (DATE (CONCAT (YEAR (CURDATE ()),'-', ELT (QUARTER (CURDATE (),), '-', 1), INTERVAL 1 QUARTER), INTERVAL 2 HOUR) 3ON completion preserve enable 4DO 5 BEGIN 6 CALL SEASON_STAT (); 7 END: Execute 1 create event TOTAL_YEAR_EVENT 2ON schedule every 1 year starts DATE_ADD (DATE (CONCAT (YEAR (CURDATE () + 1, '-', 1, '-', 1), INTERVAL 4 HOUR) 3ON completion preserve enable 4DO 5 BEGIN 6 CALL YEAR_STAT (); 7 END MySQL events are performed by month, quarter, for testing, you can change the system to the last day of the year, for example, 23:59:55;