MySQL Event introduces new features using MySQL 5.1

Source: Internet
Author: User

The following articles mainly introduce the new feature of MySQL Event using MySQL 5.1, that is, Event Scheduler, which can execute some tasks on a regular basis, which can be said to bring great convenience to development. If you want to use Event Scheduler, first check whether Event scheduler is enabled, as shown below:

 
 
  1. MySQL> select @@event_scheduler;  
  2. MySQL> show variables like 'event_scheduler'; 


If not, enable it.

 
 
  1. MySQL> set GLOBAL event_scheduler=ON; 

Or

 
 
  1. MySQL> set GLOBAL event_scheduler=1; 

Create a table first.

 
 
  1. MySQL> delimiter //  
  2. MySQL> create table t_event (event_id int not null auto_increment primary key, created timestamp); 

Create a MySQL event

 
 
  1. MySQL> create event e_insert on schedule every 5 second starts timestamp '2010-01-12 23:22:00' enable do  
  2. insert into t_event (created) values(current_timestamp); 

Invalid

 
 
  1. MySQL> alter event e_insert disable;  

The above content is an introduction to the MySQL Event. I hope you will have some gains.
 

 

Related Article

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.