A brief discussion on MySQL event planning tasks

A brief discussion on MySQL event planning tasks

1. Check whether event is enabled

show variables like '%sche%';
set global event_scheduler =1;

two,

-- Set the time zone and set the event scheduler to ON, or event_scheduler = ON
set time_zone = '+8:00';
set GLOBAL event_scheduler = 1;

-- Set the database base database used or to which this event belongs
use test;

-- If there is a task plan with this name, delete it first
drop event if exist test_update;

-- Set the delimiter to '$$'. The default statement delimiter for MySQL is ';'. This way, the subsequent create to end code will be treated as a single statement for execution.
DELIMITER $$

-- Create a scheduled task, set the first execution time to '2012-11-15 10:00:00', and execute it once a day

-- on schedule every 30 seconds
-- on schedule every day starts timestamp '2012-11-15 10:00:00'

create event test_update
on schedule every day starts timestamp '2012-11-15 10:00:00'
do

-- Start the task to do
begin

-----------------------------------
-- do something Write what your cron job is going to do
-----------------------------------

-- End the scheduled task
end $$

-- Set the statement separator back to ';'
DELIMITER ;

The above is all I have to say about MySQL event planning. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • MySQL Scheduled Tasks (Event Scheduler) Event Scheduler Introduction
  • MySQL scheduled script execution (scheduled task) command example
  • Commonplace talk about MySQL event scheduler (must read)
  • Detailed explanation of creating scheduled tasks with MySQL Event Scheduler
  • Introduction to using MySQL event scheduler
  • MySQL Event Scheduler
  • Use MySQL event scheduler to delete binlog regularly
  • Basic Learning Tutorial on Event Scheduling in MySQL
  • Analysis of MySQL's planned tasks and event scheduling examples

<<:  A set of code based on Vue-cli supports multiple projects

>>:  Practical example of Vue virtual list

Recommend

Solution to the problem of large font size on iPhone devices in wap pages

If you don't want to use javascript control, t...

Summarize the common application problems of XHTML code

<br />For some time, I found that many peopl...

WeChat applet custom bottom navigation bar component

This article example shares the specific implemen...

Using JavaScript in HTML

The <script> tag In HTML5, script has the f...

How to change password and set password complexity policy in Ubuntu

1. Change password 1. Modify the password of ordi...

Steps to build a file server using Apache under Linux

1. About the file server In a project, if you wan...

Nginx configuration PC site mobile site separation to achieve redirection

Use nginx to configure the separation of PC site ...

Examples of using && and || operators in javascript

Table of contents Preface && Operator || ...

Useful codes for web page creation

<br />How can I remove the scroll bar on the...

Detailed explanation of how to use zabbix to monitor oracle database

1. Overview Zabbix is ​​a very powerful and most ...

About IE8 compatibility: Explanation of the X-UA-Compatible attribute

Problem description: Copy code The code is as fol...

MySQL MyISAM default storage engine implementation principle

By default, the MyISAM table will generate three ...

Detailed explanation of webpack-dev-server core concepts and cases

webpack-dev-server core concepts Webpack's Co...