snippetsqlMinor
How to turn Event Scheduler On permanently in MySQL?
Viewed 0 times
turnschedulerpermanentlymysqlhowevent
Problem
How do I turn on the event scheduler in mysqld permanently? I'm using phpMyAdmin and I have scheduled an event to copy records from one table to another everyday at a specific time, but the records are not being copied everyday. I've tried setting the event scheduler on.
When I restart my pc, the event scheduler is turned off. How do I make it be always on, and not turned off when mysqld is restarted?
SET GLOBAL event_scheduler="ON";When I restart my pc, the event scheduler is turned off. How do I make it be always on, and not turned off when mysqld is restarted?
Solution
This is quite an easy one really (one of those "Doh" moments :-) ).
You set it in
(or
From the MySQL documentation here, you have:
When the Event Scheduler is ON, the event scheduler thread is listed
in the output of SHOW PROCESSLIST as a daemon process, and its state
is represented as shown here:
A
So, run:
and there should be an entry like this:
You set it in
my.cnf as described here:[mysqld]
..
.. other_stuff
..
event_scheduler=on
..
.. more_stuff
..(or
my.ini if you're running Windows as pointed out below) From the MySQL documentation here, you have:
When the Event Scheduler is ON, the event scheduler thread is listed
in the output of SHOW PROCESSLIST as a daemon process, and its state
is represented as shown here:
A
daemon process is one that runs in the background as described here. Also known as a service in WindowsSo, run:
mysql> SHOW PROCESSLIST\Gand there should be an entry like this:
*************************** 2. row ***************************
Id: 2
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon <<<<<====== Note: Daemon!!!
Time: 3
State: Waiting for next activation
Info: NULL
2 rows in set (0.00 sec)Code Snippets
[mysqld]
..
.. other_stuff
..
event_scheduler=on
..
.. more_stuff
..mysql> SHOW PROCESSLIST\G*************************** 2. row ***************************
Id: 2
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon <<<<<====== Note: Daemon!!!
Time: 3
State: Waiting for next activation
Info: NULL
2 rows in set (0.00 sec)Context
StackExchange Database Administrators Q#95143, answer score: 8
Revisions (0)
No revisions yet.