MySQL regularly performs task-related issues

Source: Internet
Author: User

Create a new event in the event SQLyog a database and write the code:

DELIMITER $ $ALTER definer= ' root ' @ '% ' EVENT ' 0 ' on SCHEDULE every HOUR starts ' 2018-04-18 00:00:00 ' ENDS ' 2028-12-31 00: 00:00 ' On completion no PRESERVE ENABLE do BEGIN    //do somethingend$ $DELIMITER;

The specific execution is written according to the specific needs, and the last on completion not preserve indicates that the event expires and is no longer retained.

Use the following code to query whether the current MySQL is allowed to execute events:

SHOW VARIABLES like ' Event_scheduler ';

query results can be performed as follows:

If the value is off, execute the following code to open:

SET GLOBAL event_scheduler = 1;

Note: Restarting MySQL will turn this value off

MySQL regularly performs task-related issues

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.