Home  >  Article  >  Database  >  How do we start the MySQL event dispatcher?

How do we start the MySQL event dispatcher?

王林
王林forward
2023-09-08 18:53:021337browse

我们如何启动 MySQL 事件调度程序?

In fact, the MySQL event scheduler is a process that runs in the background and is constantly looking for events to execute. But before we create or schedule an event, we just need to start the scheduler. It can be started 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 the 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 shut down by the following statement -

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

The above is the detailed content of How do we start the MySQL event dispatcher?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete