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

后端 未结 5 445
暖寄归人
暖寄归人 2020-12-14 06:29

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;         


        
相关标签:
5条回答
  • 2020-12-14 07:00

    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)

    0 讨论(0)
  • 2020-12-14 07:09

    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.

    0 讨论(0)
  • 2020-12-14 07:10

    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

    0 讨论(0)
  • 2020-12-14 07:12
    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

    0 讨论(0)
  • 2020-12-14 07:14

    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

    0 讨论(0)
提交回复
热议问题