I have successfully created an event in MySQL to update a column called dob
in a table called auth
.
My problem is that the event won't run. Here is my code:
DELIMITER $$
CREATE EVENT update_event1
ON SCHEDULE EVERY 1 MINUTE
ON COMPLETION PRESERVE
DO
BEGIN
UPDATE auth set dob=DATE_ADD(dob,INTERVAL 1 DAY) ;
END $$;
How to solve this problem?
Best Answer
It seem that your event scheduler is not running causing the problem of event not getting executed. use following command to check
if you get that it is off, you can do if you are in MySQL 5.6 or higher
or add the following line in cnf file to make this change permanent and in versions <5.6
The given code would work once you turn on the event scheduler using above approach.
Hope it helps.