/** Check whether the event is Enabled: show variables like '% event_sche %'; enable the event plan: set global event_scheduler = 1; disable the event plan: set global event_scheduler = 0; close EVENT task: alter event eventName on completion preserve disable; enable event task: alter event eventName on completion preserve enable; view EVENT task: show events; delimiter // sets the statement terminator to //, which is used by the Stored Procedure statement. End **/drop table if exists test; create table test (id bigint (11) unsigned not null AUTO_INCREMENT, name varchar (100) not null default '', create_time datetime, primary key (ID) ENGINE = InnoDB AUTO_INCREMENT = 1 default charset = utf8; DELIMITER // drop procedure if exists p_test // create procedure p_test () begin insert into test (name, create_time) values ('testname', now ()); END // drop event if exists e_test // create event e_test on schedule every 10 second starts timestamp '2017-04-09 01:00:00 'on completion preserve do begin call p_test (); END //
The preceding event e_test indicates that p_test () is executed every 10 seconds ()