Events do not work in MySQL?

On the server you installed the latest mysql, apache, nginx
Ubuntu 16.10
The variable included
SET GLOBAL event_scheduler=ON;
Event ID
CREATE DEFINER=`root`@`localhost` EVENT `delete_old_session` ON SCHEDULE EVERY 1 DAY STARTS '2017-04-06 10:58:44' ON COMPLETION NOT PRESERVE ENABLE DO DELETE FROM `session` WHERE `time` >= UNIX_TIMESTAMP() - 86400

However, as the session table is not cleared, tell me where did I go wrong?
June 26th 19 at 14:13
1 answer
June 26th 19 at 14:15
Solution
That show SHOW EVENTS and SHOW PROCESSLIST
Most likely the event worked once and topolos you have provided ON COMPLETION NOT PRESERVE
Yes. Then the job will remain in the list after execution. - Kenyatta commented on June 26th 19 at 14:18

>SHOW EVENTS

Db: base
Name: delete_old_session
Definer: root@localhost
Time zone: SYSTEM
Type: RECURRING
Execute at: NULL
Interval value: 1
Interval field: DAY
Starts: 2017-04-06 10:58:44
DS: NULL
Status: ENABLED
Originator: 0
character_set_client: utf8mb4
collation_connection: utf8mb4_unicode_ci
Database Collation: utf8_general_ci


>SHOW PROCESSLIST

Id: 45687
User: event_scheduler
Host: localhost
db: NULL
Command: Daemon
Time: 2701
State: Waiting for next activation
Info: NULL


Id: 46218
User: phpmyadmin
Host: localhost
db: NULL
Command: Sleep
Time: 0
State: 
Info: NULL

Id: 46219
User: root
Host: localhost
db: base
Command: Query
Time: 0
State: starting
Info: SHOW PROCESSLIST

Remove NOT?
ON COMPLETION NOT PRESERVE - Gabrielle73 commented on June 26th 19 at 14:21
: Sorry, I was wrong. NOT in this case no effect because it is not spelled out end time events.
In the mysql logs error messages there? Team
DELETE FROM `session` WHERE `time` >= UNIX_TIMESTAMP() - 86400

running manually works OK? - Kenyatta commented on June 26th 19 at 14:24
Yes the error was in request, had to write:
DELETE FROM `session` WHERE `time` <= UNIX_TIMESTAMP() - 86400

Thanks for the help. - Gabrielle73 commented on June 26th 19 at 14:27

Find more questions by tags SQLMySQL