How to set global event_scheduler=ON even if MySQL is restarted?

别等时光非礼了梦想. 提交于 2019-11-30 06:42:45

问题


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;

回答1:


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




回答2:


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.




回答3:


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)




回答4:


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




回答5:


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



来源:https://stackoverflow.com/questions/20112395/how-to-set-global-event-scheduler-on-even-if-mysql-is-restarted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!