Event not start

Joe's profile image Joe posted 1 year ago in General Permalink

Hello, I have problem to start this event. There are I see no errors and I can save. The Intervat sould start every 5 Minutes. Its not starting. Start in 2 Minute one time not works too. It seems that I have a big dummy problem ;-) Can u help ?

BEGIN SET @max_wiederholungen = 10; SET @wiederholungen = 0; WHILE @wiederholungen < @max_wiederholungen DO DELETE FROM e_nr WHERE LENGTH(e_nr) < 20 OR left(e_nr,12) = '00000000-mM-'; SET @wiederholungen = @wiederholungen + 1; END WHILE; END

Joe's profile image Joe posted 1 year ago Permalink

Same this here:

BEGIN DECLARE aktuelle_zeit DATETIME; SET aktuelle_zeit = NOW(); SET @max_wiederholungen = 10; SET @wiederholungen = 0; WHILE @wiederholungen < @max_wiederholungen DO DELETE FROM vorfaelle WHERE status = 'inaktiv' AND TIMESTAMPDIFF(MINUTE, time_stamp, aktuelle_zeit) > 5; SET @wiederholungen = @wiederholungen + 1; END WHILE;

SET @max_wiederholungen = 10;
SET @wiederholungen = 0;
WHILE @wiederholungen < @max_wiederholungen DO
    DELETE FROM register
    WHERE status = 'inaktiv';
    SET @wiederholungen = @wiederholungen + 1;
END WHILE;

END

Joe's profile image Joe posted 1 year ago Permalink

Now all is ok. Thanks:joe

Joe's profile image Joe posted 1 year ago Permalink

Solution was :

set global event_scheduler = on;
ansgar's profile image ansgar posted 1 year ago Permalink

Yes, the scheduler has to be activated on the server. Preferrably you do that in the my.ini/my.cnf file. The SET GLOBAL ... command activates it, but the setting will be lost when the server restarts for some reason.

[mysqld]
event-scheduler=ON

Please login to leave a reply, or register at first.