The following articles mainly describe the actual operation steps for MySQL scheduled execution, as well as the descriptions worth your attention in the actual operation process of MySQL scheduled execution, if you are interested in the actual operations, you can browse the following articles.
Check whether event is enabled
- show variables like '%sche%';
Enable the event plan
- set global event_scheduler =1;
Create a stored procedure test
- CREATE PROCEDURE test ()
- BEGIN
- update examinfo SET endtime = now() WHERE id = 14;
- END;
Create event e_test
- 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
- alter event e_test ON
- COMPLETION PRESERVE DISABLE;
Account Opening event task
- 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 above content is a description of MySQL scheduled execution, hoping to help you in this regard.
Original article title: scheduled execution in MySQL
Connection: http://www.cnblogs.com/jembai/archive/2009/12/14/1623403.html