I want to set the event_scheduler
global to ON
even if MySQL is restarted; how can I achieve this?
SET GLOBAL event_scheduler = ON;
Open your /etc/mysql/my.ini file and add:
event_scheduler = on
under the [mysqld] section
(tested under mysql 5.5.35-0+wheezy1 - Debian)
You can set
event_scheduler=ON
in my.ini
or my.cnf
file, then restart your server for the setting to take effect.
Once set event_scheduler
will always remain ON
no matter whether your server restarts.
On our Windows Server 2012 system, none of these or any other solutions worked. Then I looked at the registry entry for start up:
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56
The trick, the evil, is ProgramData
. It's not Program Files
. Look in Program Files and you'll see a my-default.ini
file, put there just to royally screw you up.
The trick is to find the path in the registry, which was for me: HKEY_LOCAL_MACHINE\SYSTEM\Services\MySQL56
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Add this line at the end of the file:
event_scheduler=ON
Than reboot and check if daemon is started after reboot:
Log into mysql bash:
mysql -u <user> -p
Than run the command:
SHOW PROCESSLIST;
Now you should see the event scheduler daemon in the list
One Way - You can set your system variables and use those variables if there is any possibility to restart your mysql.
Here is link Using system variables in mysql