Enabling mysql Event scheduler on server restarts

半腔热情 提交于 2019-12-18 03:45:07

问题


I am running phpmyadmin and installed apache server on my personal computer. My problem is that I am trying to set MySQL event_scheduler to always be enabled even when the server restarts. I was reading that by setting the following command line in the server configuration file (my.cnf or my.ini) it should work: event_scheduler=DISABLED. However, where do I locate this my.cnf or my.ini file, and also should the command line be event_scheduler=DISABLED or event_scheduler=ENABLED seeing that I want it to always be enabled?


回答1:


You should set 'ON' value (not ENABLED).

In the configuration file in [mysqld] section specify 'event-scheduler' option (not event_scheduler).

Also, you can start your MySQL server with '--event-scheduler' option, e.g. -

shell> mysqld --event-scheduler=ON

More information - event_scheduler system variable.




回答2:


Add to my.cnf file to [mysqld] section.

GLOBAL event_scheduler=ON

Restart your mysql server. Check status with this command :

mysql> select @@GLOBAL.event_scheduler;
+--------------------------+
| @@GLOBAL.event_scheduler |
+--------------------------+
| ON                       |
+--------------------------+
1 row in set (0.00 sec)

mysql> SHOW VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.01 sec)



回答3:


Here the path for my.ini on XAMPP:

xampp\mysql\bin\my.ini

Open my.ini and add the following

[mysqld]
event_scheduler=ON

then restart MySQL service.

To check the status use the below MySQL query:

SELECT @@event_scheduler



回答4:


For WAMP:

  1. Edit your my.ini file and under the [mysqld] section, add this:

    event-scheduler=on

  2. restart all services

  3. verify by running this query:

    select @@event_scheduler;

To get to your my.ini file, just click the WAMP tray icon and hover over the 'MySQL' menu, and click 'my.ini'.




回答5:


FOR MAMP on OS X:

the default installation does not include a my.cnf file so you need to create one and set up your default configuration. Therefore, to enable the the scheduler on an OS X MAMP stack, you need to,

  1. stop your MySQL server
  2. create a my.cnf file in your /Applications/MAMP/conf/ folder, you will need root access to do this (open a terminal window),

    sudo touch /Applications/MAMP/conf/my.cnf

    sudo nano /Applications/MAMP/conf/my.cnf

  3. the 2nd cmd will open the nano editor, paste the following in your file,

    [mysqld]

    event_scheduler=ON

  4. Save (^O) and exit (^X) the nano editor

  5. restart your MySQL server.



来源:https://stackoverflow.com/questions/10071871/enabling-mysql-event-scheduler-on-server-restarts

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