To permanently enable the MySQL Event Scheduler, you need to modify the MySQL configuration file so that it remains enabled after a server restart.

Check the Current Status

Before making changes, check whether the Event Scheduler is currently enabled:

SHOW VARIABLES LIKE 'event_scheduler';

Expected output if disabled:

+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| event_scheduler | OFF |
+-----------------+-------+

If the value is OFF, you need to enable it.

Enable Event Scheduler for the Current Session (Temporary)

If you only need to enable the Event Scheduler temporarily (until the MySQL service restarts), run:

SET GLOBAL event_scheduler = ON;
  • This does not persist after a MySQL restart.
  • You need SUPER privileges to execute this command.

Enable Event Scheduler Permanently (Recommended)

To ensure Event Scheduler is always enabled, modify MySQL configuration file.

For Linux / macOS (Self-Hosted MySQL, MariaDB)

1

Edit MySQL configuration file

sudo nano /etc/mysql/my.cnf

For MariaDB, the file may be located at:

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
2

Add the following line under [mysqld]

[mysqld]
event_scheduler=ON
3

Save and exit (Ctrl + X, then Y)

4

Restart MySQL

sudo systemctl restart mysql
5

Verify the status

SHOW VARIABLES LIKE 'event_scheduler';

Expected output:

+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| event_scheduler | ON |
+-----------------+-------+

For Windows (XAMPP, WAMP, MySQL Server)

1

Open MySQL configuration file (my.ini)

Typically located at:

C:\ProgramData\MySQL\MySQL Server x.x\my.ini

Or inside your XAMPP/WAMP installation.

2

Add this under [mysqld]

[mysqld]
event_scheduler=ON
3

Save the file

4

Restart MySQL

Open Services Manager (services.msc), find MySQL and click Restart.

5

Verify using

SHOW VARIABLES LIKE 'event_scheduler';

Expected output:

+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| event_scheduler | ON |
+-----------------+-------+

Troubleshooting

Issue Solution
Permission denied while editing my.cnf/my.ini Use sudo (Linux) or open as Administrator (Windows).
event_scheduler resets to OFF after restart Ensure event_scheduler=ON is inside [mysqld] in my.cnf or my.ini.
MySQL does not restart Check the MySQL error logs (/var/log/mysql/error.log).
Access denied: SUPER privilege required Ask the DB admin to enable event_scheduler or modify my.cnf.

Alternative: Managed MySQL Services (AWS RDS, Google Cloud)

If you are using a managed MySQL service (e.g., AWS RDS, Google Cloud SQL), you cannot edit my.cnf directly. Instead:

  • Use custom parameter groups:
    1. Go to AWS RDS Console > Parameter Groups.
    2. Find event_scheduler, set it to ON, and apply it.
  • For permanent enabling, edit my.cnf (Linux/macOS) or my.ini (Windows).
  • For temporary use, run SET GLOBAL event_scheduler = ON;.
  • For managed MySQL services, use a custom parameter group.