I'm trying to create an EVENT to fire up at schedule everyday to update data in table. I have set the event_scheduler ON in MySQL with SET GLOBAL event_scheduler = ON; command, and this is what I see when I run the following:
MariaDB [hr]> SHOW PROCESSLIST;
+-----+-----------------+-----------+------+---------+-------+--------------------------+------------------+----------+
| Id | User | Host | db | Command | Time | State | Info | Progress |
+-----+-----------------+-----------+------+---------+-------+--------------------------+------------------+----------+
| 1 | system user | | NULL | Daemon | NULL | InnoDB purge coordinator | NULL | 0.000 |
| 2 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 3 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 4 | system user | | NULL | Daemon | NULL | InnoDB purge worker | NULL | 0.000 |
| 5 | system user | | NULL | Daemon | NULL | InnoDB shutdown handler | NULL | 0.000 |
| 228 | event_scheduler | localhost | NULL | Daemon | 10486 | Waiting on empty queue | NULL | 0.000 |
| 613 | root | localhost | hr | Query | 0 | Init | SHOW PROCESSLIST | 0.000 |
+-----+-----------------+-----------+------+---------+-------+--------------------------+------------------+----------+
7 rows in set (0.000 sec)
So event_scheduler is indeed running. This is how I am creating the trigger:
CREATE EVENT update_attendance
ON SCHEDULE
EVERY 1 MINUTE
DO
UPDATE attendance SET markedAttendance = 1;
When I run this, it says Query OK, 0 rows affected (0.000 sec), but when I run SHOW EVENTS it returns an empty set. Also if I do DROP update_attendance it drops the event. The trigger is never executed even once. I am running XAMPP's MySQL on Windows 10. I do not understand what is going on. What am I doing wrong here?
ON COMPLETION PRESERVEas well..SHOW WARNINGS;directly after theCREATE EVENTmaybe you get a hint why it is not working..