Enable and Disable Event scheduler in MySQL

Event Scheduler is runs in the background and manages the execution of scheduled events. Event scheduler is used for scheduling the jobs and tasks performed in MySQL database on specified time and intervals.

Enable the Event Scheduler

SET GLOBAL event_scheduler = ON;
SET @@GLOBAL.event_scheduler = ON;
SET GLOBAL event_scheduler = 1;
SET @@GLOBAL.event_scheduler = 1;

Disable the Event Scheduler:


SET GLOBAL event_scheduler = OFF;
SET @@GLOBAL.event_scheduler = OFF;
SET GLOBAL event_scheduler = 0;
SET @@GLOBAL.event_scheduler = 0;

For enable or disable in my.cnf or my.ini configuration file:

For enable, use as comment  
--event_scheduler=DISABLED

--For Disable, remove comment --
event_scheduler=DISABLED

Verify the Service for Event Scheduler is running:

SHOW PROCESSLIST;

mysql> show processlist;
+----+-----------------+-----------------+------+---------+--------+------------------------+------------------+
| Id | User            | Host            | db   | Command | Time   | State                  | Info             |
+----+-----------------+-----------------+------+---------+--------+------------------------+------------------+
|  5 | event_scheduler | localhost       | NULL | Daemon  | 175650 | Waiting on empty queue | NULL             |
|  8 | root            | localhost:63048 | NULL | Query   |      0 | init                   | show processlist |
+----+-----------------+-----------------+------+---------+--------+------------------------+------------------+
2 rows in set (0.00 sec)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.