当前时间 - 某行expire_date字段 >= 0 ,删除数据
CREATE DEFINER=`root`@`%` PROCEDURE `db111`.`proc_del_data`()
BEGIN
delete from db111.sys_user where(SELECT TO_DAYS(NOW()) - TO_DAYS(expire_date))>=0;
END
每天执行一次PROCEDURE
CREATE EVENT event_del_data
ON SCHEDULE EVERY 1 DAY
STARTS '2023-02-01 00:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL proc_del_data()