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

A comparison between the href attribute and onclick event of the a tag

First of all, let's talk about the execution ...

Sqoop export map100% reduce0% stuck in various reasons and solutions

I call this kind of bug a typical "Hamlet&qu...

Why can't I see the access interface for Docker Tomcat?

Question: Is the origin server unable to find a r...

Talk about important subdirectory issues in Linux system

/etc/fstab Automatically mount partitions/disks, ...

Vue implements scrollable pop-up window effect

This article shares the specific code of Vue to a...

5 things to note when writing React components using hooks

Table of contents 01. Use useState when render is...

Detailed explanation of Linux inotify real-time backup implementation method

Real-time replication is the most important way t...

WeChat applet implements user login module server construction

I chose node.js to build the server. Friends who ...

Summary of three ways to create new elements

First: via text/HTML var txt1="<h1>Tex...

Using js to achieve the effect of carousel

Today, let's talk about how to use js to achi...

How to set up remote access to a server by specifying an IP address in Windows

We have many servers that are often interfered wi...

22 Vue optimization tips (project practical)

Table of contents Code Optimization Using key in ...

mysql obtains statistical data within a specified time period

mysql obtains statistical data within a specified...

Summary of some tips on MySQL index knowledge

Table of contents 1. Basic knowledge of indexing ...