How can we start MySQL event scheduler?



Actually, MySQL event scheduler is a process that runs in the background and constantly looks for the events to execute. But before we create or schedule an event we just have to start the scheduler. It can start with the help of the following statement −

mysql> SET GLOBAL event_scheduler = ON; Query OK, 0 rows affected (0.07 sec)

Now with the help of the following statement, we can check its status in MySQL process list −

mysql> SHOW PROCESSLIST\G *************************** 1. row ***************************      Id: 3    User: root    Host: localhost:49500      db: query Command: Query    Time: 0   State: starting    Info: SHOW PROCESSLIST *************************** 2. row ***************************      Id: 4    User: event_scheduler    Host: localhost      db: NULL Command: Daemon    Time: 11   State: Waiting on empty queue    Info: NULL 2 rows in set (0.06 sec)

It can be turn off with the help of the following statement −

mysql> SET GLOBAL event_scheduler = OFF; Query OK, 0 rows affected (0.07 sec)
Updated on: 2020-06-22T12:30:22+05:30

920 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements