时间:2021-07-01 10:21:17 帮助过:2人阅读
DROP EVENT IF EXISTS job_insertgood;
DELIMITER $$
CREATE EVENT job_insertgood
ON SCHEDULE EVERY 10 SECOND
DO
BEGIN
INSERT INTO goods (name,num) VALUES (now(),1);
END$$
DELIMITER ;
二、事件:调用存储过程
DROP EVENT IF EXISTS job_callProcedure;
DELIMITER $$
CREATE EVENT job_callProcedure
ON SCHEDULE EVERY 10 SECOND
DO
BEGIN
CALL procedureName();
END$$
DELIMITER ;
三、开启事件(定时任务):
1、查看
SELECT @@event_scheduler;
或者
SHOW VARIABLES LIKE ‘event%‘
2、设置:
set GLOBAL event_scheduler = 1;
或者
SET GLOBAL event_scheduler = ON;
mysql 基础 事件(定时任务)
标签:事件