1.创建存储过程
CREATE PROCEDURE hz_hzs_snyncj_sqrjtcy() BEGIN TRUNCATE hz_detla; END
2.定时执行此存储过程
#查看是否开启event_scheduler show variables like'%sche%';#开启event_scheduler set global event_scheduler=1;#创建定时执行事件,样例为自2023-03-1117:04:00 后,每天执行一次 create event if not EXISTS hz_detla1 ON SCHEDULE EVERY 1 DAY STARTS '2023-03-11 17:04:00'on completion preserve do call hz_detla();#刷新 show events;