It is not difficult to implement MySQL regular execution!

Source: Internet
Author: User

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

 
 
  1. show variables like '%sche%'; 

Enable the event plan

 
 
  1. set global event_scheduler =1; 

Create a stored procedure test

 
 
  1. CREATE PROCEDURE test ()  
  2. BEGIN  
  3. update examinfo SET endtime = now() WHERE id = 14;  
  4. END; 

Create event e_test

 
 
  1. create event if not exists e_test  
  2. on schedule every 30 second  
  3. on completion preserve  
  4. 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

 
 
  1. alter event e_test ON   
  2. COMPLETION PRESERVE DISABLE; 

Account Opening event task

 
 
  1. alter event e_test ON   
  2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.