当前位置:网站首页>mysql开启定时调度任务执行
mysql开启定时调度任务执行
2022-07-23 07:48:00 【健康平安的活着】
一 开启事件配置
1.1 开启事件配置
show variables like '%event_sche%'

1.临时会话的修改,注意mysql服务重新启动将失效
set global event_scheduler=1

2.在/etc/my.cnf配置文件中进行配置:event_scheduler=1,然后重新启动mysql服务
# *** 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]
# 一般配置选项
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

二 案例演示
1.新建存储过程
CREATE PROCEDURE test_d2()
BEGIN
DROP TABLE IF EXISTS test_ddd;
/*************************************/
CREATE table test_ddd AS SELECT NOW()
;
END2.设置定时计划
1.每5秒执行一次
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.设置指定时刻执行
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();
边栏推荐
- 赛扬n5095处理器怎么样 英特尔n5095核显相当于什么水平
- LeetCode_491_递增子序列
- KingbaseESV8R6不同隔离级下xmin的区别
- 图像处理1:RGB888_YCbCr444
- Detailed introduction of RIP
- Creo 9.0 如何快速修改CAD坐标系?
- FPGA:ov7725摄像头通过VGA/HDMI显示RGB565格式的图像
- 200 lines of code, in-depth analysis of the principle and implementation of dynamic calculation diagram
- Kingbasees formatting function
- 静态综合实验(HCIA)
猜你喜欢

MGRE实验

C #: in, out, ref Keywords

建立STM32F103C8T6工程模板和STM32 ST-LINK Utilit烧录hex文件

Several methods of transferring parameters from child components to parent components
![[laser principle and application -7]: semiconductor refrigeration sheet and Tec thermostat](/img/c8/e750ff7c64e05242eac7b53b84dbae.png)
[laser principle and application -7]: semiconductor refrigeration sheet and Tec thermostat

解决报错:Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “

达人评测 酷睿i9 12950hx和i9 12900hx区别哪个强

RIP实验

CSDN recommended template

BERT 文章翻译
随机推荐
2022 summer vacation software innovation laboratory training project practice 1
《Animal Farm》笔记
Tutorial on principles and applications of database system (040) -- MySQL query (II): set the column name or expression to be queried
LeetCode_ 52_ Queen n II
Rip experiment
锐龙R7 PRO 6850H核显性能怎么样?相当于什么水平
Classes and objects (top)
容器网络原理
Excel essay record
MGRE环境下的OSPF实验:
Golang remote server debugging
LeetCode_ 491_ Longest increasing subsequence
解决报错:Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “
[激光器原理与应用-7]: 半导体制冷片与TEC温控器
rtx3080相当于gtx什么显卡 rtx3080显卡什么水平 rtx3080显卡怎么样
图像处理2:均值滤波
MGRE comprehensive experiment
Google Earth engine -- a small bug in gee. Images of transcontinental boundaries cannot be obtained
Data link layer protocol, PPP session
Ti single chip millimeter wave radar 1642 code walk through (0) - General Outline