Since MySQL5.1.0, an Event sched (Event sched) feature has been added, which can be used to regularly execute certain tasks (for example: delete records, summarize data, and so on) to replace jobs that can only be executed by scheduled tasks of the operating system. It is worth mentioning that the MySQL event scheduler can execute a task exactly every second, and the scheduled task of the operating system (such as CRON in Linux or task plan in Windows) it can be executed only once per minute. It is suitable for applications that require high real-time data (such as stocks, odds, and scores.
The event scheduler can also be called a temporary trigger (temporal triggers), because the event scheduler executes some tasks based on the Triggers triggered at a specific time period, and the trigger (triggers) is Triggered Based on the event generated by a table.
Check whether the event is Enabled:
Show variables like 'event % ';
SELECT @ event_scheduler;
Show processlist;
If event_schedist is on or PROCESSLIST shows event_schedist information, the event is enabled. If the event is off or the event_scheduler information cannot be viewed in PROCESSLIST, it indicates that the event is not enabled and we need to enable it.
Temporarily enable (mysql service becomes invalid after restart)
Set global event_scheduler = 1; // 0 indicates disabled
Enable permanently:
Add the following content in [mysqld] Of my. cnf and restart mysql (mysql restart command: service mysqld restart)
Event_scheduler = ON