当前位置:网站首页>MySQL enables scheduled task execution
MySQL enables scheduled task execution
2022-07-23 14:08:00 【Live healthy and safe】
One Enable event configuration
1.1 Enable event configuration
show variables like '%event_sche%'

1. Modification of temporary session , Be careful mysql Service restart will fail
set global event_scheduler=1

2. stay /etc/my.cnf Configuration in the configuration file :event_scheduler=1, And then restart it mysql service
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
port = 3306
default-character-set=utf8
[mysqld]
# General configuration options
basedir = /usr/local/mysql-5.7.29
datadir = /usr/local/mysql-5.7.29/data
default-time-zone=+08:00
event_scheduler=1
port = 3306
character-set-server=utf8
default_storage_engine = InnoDB
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
explicit_defaults_for_timestamp=true

Two Case presentation
1. New stored procedure
CREATE PROCEDURE test_d2()
BEGIN
DROP TABLE IF EXISTS test_ddd;
/*************************************/
CREATE table test_ddd AS SELECT NOW()
;
END2. Set a schedule
1. Every time 5 Once per second
DROP EVENT IF EXISTS hh;
create event hh
ON SCHEDULE EVERY 5 SECOND STARTS TIMESTAMP '2022-07-22 01:00:00'
ON COMPLETION PRESERVE
DO
begin
CALL test_d2();
end2. Set the specified time to execute
drop event if exists t_event_name ;
create event t_event_name
on schedule at '2022-07-22 09:07:00' on completion preserve
do call test_d2();
MYSQL Chapter nine View 、 Indexes 、 Stored procedures and triggers - zzzzy09 - Blog Garden
边栏推荐
- 判断一个对象是否是空对象的处理办法
- 锐龙R7 PRO 5875U性能怎么样?相当于什么水平级别
- 锐龙R7 PRO 6850H核显性能怎么样?相当于什么水平
- Static comprehensive experiment (HCIA)
- How to ensure the reliable transmission of messages? What if the message is lost
- 英特尔赛扬7305性能怎么样?相当于什么水平级别
- Creo 9.0 键鼠操作进行模型观察
- Classes and objects (top)
- 《Animal Farm》笔记
- 笔记本酷睿i5 1135g7相当于什么水平?i5 1135g7性能怎么样
猜你喜欢
随机推荐
Principle of container network
锐龙R7 PRO 6850H核显性能怎么样?相当于什么水平
第五天笔记
200 行代码,深入分析动态计算图的原理及实现
Unity makes simple intercepting close range artillery - how to predict the strike target
Google Earth engine -- a small bug in gee. Images of transcontinental boundaries cannot be obtained
Several methods of transferring parameters from child components to parent components
Data link layer protocol, PPP session
How can Creo 9.0 quickly modify CAD coordinate system?
达人评测 酷睿i9 12950hx和i9 12900hx区别哪个强
Kingbaseesv8r6 difference of xmin under different isolation levels
数千个数据库、遍布全国的物理机,京东物流全量上云实录 | 卓越技术团队访谈录
使用Stream流来进行分类展示。
LeetCode_ 46_ Full Permutation
Detailed introduction of RIP
Image processing 3: Sobel edge detection
赛扬n5095处理器怎么样 英特尔n5095核显相当于什么水平
How hot is July? Crawl through the crawler to get the temperature information of the current month, and use Matplotlib to draw the temperature line chart
MGRE综合实验
Kafka consumption reports an error coordinator unavailable Rediscovery will be attempt redisCovery









