Database ServerMySQL

How to enable MySQL event scheduler using command line

The management of events, or tasks that run on a timetable, is handled by the MySQL Event Scheduler. The MySQL Event Scheduler needs to be enabled for some applications to work flawlessly.

In this article, let's discuss the steps to enable the MySQL event scheduler on Linux operating systems like Red Hat Linux, CentOS, Ubuntu, Fedora, RockyLinux, and Debian.

Steps to enable MySQL event scheduler

Step 1: Login into the MySQL command prompt using root or admin privileges.

mysql -u root -p

Step 2: Execute below MySQL command to enable MySQL event scheduler

SET GLOBAL event_scheduler = ON;

Step 3: Check the status of MySQL event scheduler

SHOW VARIABLES WHERE VARIABLE_NAME = 'event_scheduler';

Step 4: To keep MySQL event scheduler always enabled, edit the MySQL configuration file my.cnf.

vi /etc/my.cnf

Step 5: Add the follow line text under mysqld section of my.cnf file

event_scheduler=on

Example:

[mysqld]
event_scheduler = on

Step 6: Restart MySQL service to apply the changes.

/etc/init.d/mysql restart

You have successfully enabled the MySQL event scheduler permanently.

Abhijit Sandhan

Love to Automate, Blog, Travel, Hike & spread Knowledge!

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Back to top button