Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql Event Not Working

I have added the following simple test event on my mysql database via phpmyadmin:

CREATE DEFINER=`root`@`localhost` EVENT `my_event`  ON SCHEDULE EVERY 1 MINUTE STARTS '2013-05-27 00:00:00'  ON COMPLETION NOT PRESERVE ENABLE DO  BEGIN     UPDATE `test` SET `name`="z"; END 

My environment is mac + MAMP Pro. I am expecting to change all rows on my 'test' table with name 'z' within a minute. But not happening so.

Do I have to something additional to get my events start working?

Output of "SHOW PROCESSLIST": enter image description here

Thanks.

like image 404
Rana Avatar asked May 27 '13 07:05

Rana


People also ask

How do I enable events 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 know if MySQL event is running?

SELECT * FROM INFORMATION_SCHEMA. events; You can also use SHOW CREATE EVENT yourevent to see what it does.

How do I drop an event in MySQL?

Syntax. DROP EVENT event_name; Where, event_name is the name of the event you need to delete.

How do I edit a event in MySQL workbench?

To rename an event, use the ALTER EVENT statement's RENAME TO clause. This statement renames the event myevent to yourevent : ALTER EVENT myevent RENAME TO yourevent; You can also move an event to a different database using ALTER EVENT ...


1 Answers

Events are run by the scheduler, which is not started by default. Using SHOW PROCESSLIST is possible to check whether it is started. If not, run the command

 SET GLOBAL event_scheduler = ON; 

to run it.

like image 96
Jacopofar Avatar answered Sep 25 '22 13:09

Jacopofar