Preface Since MySQL 5.1.6, a very unique feature has been added - Event Scheduler, which can be used to perform certain specific tasks (such as deleting records, aggregating data, etc.) at a scheduled time to replace the work that could only be performed by the operating system's scheduled tasks. What is more worth mentioning is that MySQL's event scheduler can execute a task accurately to every second, while the operating system's scheduled tasks (such as CRON under Linux or task scheduling under Windows) can only be executed accurately to once per minute. It is very suitable for applications that have high requirements for real-time data (such as stocks, odds, scores, etc.). This article will give you a detailed introduction about MySQL scheduled tasks and share it for your reference. Let's take a look at the detailed introduction. mysql scheduled tasks Application scenario: Automatically change the order status to received 15 days after delivery Implementation method: MySQL event 1. Check whether the event is enabled. It is disabled by default. SHOW VARIABLES LIKE 'event_scheduler'; 2. Enable event set global event_scheduler=on; 3. Create a function Note the following parameters 4. Then just start it in your own code. It is usually enabled when shipping in the background (I also include the function of automatically canceling orders within 15 minutes) Attached to close the scheduled task alter event event_day_update ON COMPLETION PRESERVE DISABLE; Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: Coexistence of python2 and python3 under centos7 system
>>: JavaScript timer to achieve seamless scrolling of pictures
This article records the detailed installation tu...
Web Application Class 1. DownForEveryoneOrJustMe ...
Table of contents Vue2 Writing Vue3 plugin versio...
Today I encountered a very strange situation. Aft...
1. Check the character set 1. Check the MYSQL dat...
This article shares the installation tutorial of ...
Table of contents Preface LED Trigger Start explo...
Table of contents Preface VMware clone virtual ma...
1. Problem Sometimes when we log in to Mysql and ...
Since the problem occurred rather suddenly and th...
Table of contents 1. Template tag in HTML5 2. Pro...
Linux col command The Linux col command is used t...
Table of contents Preface 1. Props, $emit one-way...
Table of contents Example 1 Example 2 Example 3 E...
1. Set up a shared folder on the virtual machine:...