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

Win10 installation Linux system tutorial diagram

To install a virtual machine on a Windows system,...

Detailed explanation of simple snow effect example using JS

Table of contents Preface Main implementation cod...

About the correct way to convert time in js when importing excel

Table of contents 1. Basics 2. Problem Descriptio...

How to install phabricator using Docker

I am using the Ubuntu 16.04 system here. Installa...

MySQL 8.0.12 winx64 decompression version installation graphic tutorial

Recorded the installation of mysql-8.0.12-winx64 ...

Tutorial on installing MySQL under Linux

Table of contents 1. Delete the old version 2. Ch...

How to use cookies to remember passwords for 7 days on the vue login page

Problem Description In the login page of the proj...

Vue implements the browser-side code scanning function

background Not long ago, I made a function about ...

Example of how to adapt the Vue project to the large screen

A brief analysis of rem First of all, rem is a CS...

Analysis of MySQL cumulative aggregation principle and usage examples

This article uses examples to illustrate the prin...

MySQL character set viewing and modification tutorial

1. Check the character set 1. Check the MYSQL dat...

jQuery plugin to implement minesweeper game (2)

This article shares the second article of using j...

How to start multiple MySQL instances in CentOS 7.0 (mysql-5.7.21)

Configuration Instructions Linux system: CentOS-7...