MySQL has a built-in event query scheduling feature for one-time and repeating queries called the Event Scheduler.
Check it's enabled
event_scheduler global variable is
show global variables like 'event_scheduler';
You should also see a process from the
event_scheduler user with
'Waiting for next activation'.
List scheduled events
Schedule an event
Scchedule a recurring event every day for a month:
create event delete_old_events on schedule every 1 hour starts current_timestamp ends current_timestamp + interval 7 day do delete from events where created_at > now() - interval 1 month limit 1000;
Drop an event:
drop event delete_old_events;