MySQL Scheduled Tasks

Source: Internet
Author: User

1, check whether the scheduled task is open mysql> set global event_scheduler=off; Query OK, 0 rows affectedmysql> select @ @event_scheduler; +-------------------+| @ @event_scheduler |+-------------------+| OFF               |+-------------------+1 row in setmysql> set global Event_schedule R=on; Query OK, 0 rows affectedmysql> select @ @event_scheduler; +-------------------+| @ @event_scheduler |+-------------------+| On                |+-------------------+1 row in Set2, creating a scheduled task mysql> show events; Empty setmysql> Create event Event_insert on schedule Every 1 second enable doing insert into Stu (name,age,updatetime) VA Lues (' Caroline ', 5,now ()); Query OK, 0 rows affectedmysql> show events;+--------+--------------+---------+-----------+-----------+---------- --+----------------+----------------+---------------------+------+---------+------------+---------------------- +----------------------+--------------------+| Db     | Name &NBSp       | Definer | Time Zone | Type      | Execute at | Interval value | Interval Field | Starts              | Ends | Status  | Originator | character_set_client | collation_connection | Database Collation |+--------+--------------+---------+-----------+-----------+------------+----------------+--- -------------+---------------------+------+---------+------------+----------------------+---------------------- +--------------------+| TestDB | Event_insert | [email protected]%  | SYSTEM    | Recurring | NULL       | 1              | SECOND         | 2015-03-25 19:57:41 | NULL | ENABLED |          0 | UTF8                 | Utf8_general_ci      | Utf8_general_ci    |+--------+--------------+---------+-----------+-----------+------------+----------------+----------------+---------------------+------+---------+------------+----------------------+------- ---------------+--------------------+1 row in Set3, timed add record mysql> delete from Stu; Query OK, 6 rows affectedmysql> select * FROM stu;+-----+----------+-----+---------------------+| Id  | Name     | Age | UpdateTime          |+-----+----------+-----+---------------------+| 232 | Caroline |   5 | 2015-03-25 19:58:57 | | 233 | Caroline |   5 | 2015-03-25 19:58:58 |+-----+----------+-----+---------------------+2 rows in Set4, modify scheduled task mysql> alter event EVENT_ Insert on Schedule every 1 second disable; Query OK, 0 rows affected

MySQL Scheduled Tasks

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.