Mysql Event Not Working

前端 未结 9 1808
-上瘾入骨i
-上瘾入骨i 2021-01-30 10:46

I have added the following simple test event on my mysql database via phpmyadmin:

CREATE DEFINER=`root`@`localhost` EVENT `my_event` 
ON SCHEDULE EVERY 1 MINUTE          


        
9条回答
  •  春和景丽
    2021-01-30 10:53

    Verify if the event_scheduler is On - execute the following command:

    SHOW PROCESSLIST;
    

    It'll output a table/entries, you must look for an entry with User event_scheduler, and Command Daemon:

    Id           User         Host      db  Command Time    State            Info
    22870   event_scheduler localhost   \N   Daemon  23    Waiting for next activation  \N
    

    OR, you can also verify using the following command:

    SELECT @@global.event_scheduler;
    

    The result should be ON, otherwise set it off (will get 0 for the command), as stated in the next section.


    If you don't have any such entry (as above), you may start the event scheduler using the following command:

     SET GLOBAL event_scheduler = ON;
    

    Once done, you can verify if it has been executed properly using the SHOW PROCESSLIST command, as mentioned above.

提交回复
热议问题