Run the following code to check whether the event is Enabled: showvariableslike % sche %; run the following code to enable the event plan: setglobalevent_scheduler1; run the following code to create the stored procedure test: CREATEPROCEDUREtest () procedure () WHEREid14; END
Check whether the code for enabling the event is as follows: show variables like '% sche %'; set global event_scheduler = 1 as follows: create procedure test () BEGIN update examinfo SET endtime = now () WHERE id = 14; END; Create event e_te
Check whether event is enabled
The Code is as follows:
Show variables like '% sche % ';
Enable the event plan
The Code is as follows:
Set global event_scheduler = 1;
Create a stored procedure test
The Code is as follows:
Create procedure test ()
BEGIN
Update examinfo SET endtime = now () WHERE id = 14;
END;
Create event e_test
The Code is as follows:
Create event if not exists e_test
On schedule every 30 second
On completion preserve
Do call test ();
The stored procedure test is executed every 30 seconds, and the current time is updated to the endtime field of the Record id = 14 in examinfo.
Close event task
The Code is as follows:
Alter event e_test ON
Completion preserve disable;
Account Opening event task
The Code is as follows:
Alter event e_test ON
Completion preserve enable;
All tests are successful. The test environment is mysql 5.4.2-beta-community mysql community server (GPL)
The above content is an introduction to the regular execution of MySQL. I hope you will have some gains.
The scheduled mysql task disappears after being restarted.
You only need to modify the configuration.
Event_scheduler is set to OFF in mysql config. Change the configuration to ON in mysql.
,