Sharcoux Sharcoux - 1 month ago 11
MySQL Question

MySQL Recurring event stops working

I am trying to create a reccurring event that should occur every day and with no end date. So I went with:

CREATE DEFINER=`xxx`@`xxx` EVENT `my_event` ON SCHEDULE EVERY 1 DAY STARTS '2016-08-23 08:00:00' ON COMPLETION PRESERVE ENABLE DO TRUNCATE TABLE `my_table`


Now, my issue is that the event seems to stop working after a while. Maybe after a reboot? What could do this? The mysql
error.log
is empty. How can I debug this ?

And by the way, am I right to select
preserve on completion
?

EDIT
Ok, I think that I found here the solution to my problem. So I guess that I should put the line

event_scheduler=ON


at the bottom of the
[mysqld]
section of the file
/etc/mysql/mysql.conf.d/mysqld.cnf


I just need to restart to be sure, but I can't do that right now.

Answer

Ok, I think that I found here the solution to my problem.

The version in this link is not the same as mine. With the current version it seems that I have to put

event_scheduler=ON

at the bottom of the [mysqld] section of the file /etc/mysql/mysql.conf.d/mysqld.cnf

After reboot, it is working.