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

How do we start the MySQL event dispatcher?

王林
Release: 2023-09-08 18:53:02
forward
1379 people have browsed it

我们如何启动 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)
Copy after login

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)
Copy after login

It can be shut down by the following statement -

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template