Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to permanently activate/set the global event_scheduler to 1 in mysql

Tags:

mysql

events

I have added a event to my mySQL db and it works fine, but the thing that is bothering me is that every now and then I have to set the mysql global variable to 1 so that my event is active.I log in as root user and have complete privileges (I use it for practice purpose)

Every time I log in to my mysql server I have to execute the following line

__set global event_scheduler=1__

can I set the event_scheduler variable permanently to 1? I'm using mysql 5.1.50 - community

like image 329
Charanraj Golla Avatar asked Sep 26 '10 12:09

Charanraj Golla


People also ask

How do I permanently set an event scheduler in MySQL?

To enable the Event Scheduler, restart the server without the --event-scheduler=DISABLED command-line option, or after removing or commenting out the line containing event-scheduler=DISABLED in the server configuration file, as appropriate.

How do I stop a scheduled event in MySQL?

SET GLOBAL event_scheduler = OFF; SET @@global. event_scheduler = OFF; SET GLOBAL event_scheduler = 0; SET @@global. event_scheduler = 0; but it stops all 5 event Scheduler.

How do I create a recurring event in MySQL?

Creating new MySQL events First, specify the name of the event that you want to create the CREATE EVENT keywords. The event names must be unique within the same database. Second, specify a schedule after the ON SCHEDULE keywords. Third, place SQL statements after the DO keyword.


2 Answers

Yes, write event_scheduler=on somewhere under the [mysqld] section in the default mysql config file, usually /etc/my.cnf

like image 126
nos Avatar answered Oct 20 '22 02:10

nos


If you are using WAMP :

Open its control panel by clicking on the WAMP icon -> mysql-> my.ini

Its location may be at:

C:\wamp\bin\mysql\mysql{your.ver.sion}

Add EVENT_SCHEDULER=ON under [mysqld] - not [mysql] notice the "d" for daemon. Another tip to ascertain where you're adding is where your (default) server port is specified.

[mysqld]
port=3306
event_scheduler=on
like image 39
Athar Avatar answered Oct 20 '22 03:10

Athar