Mysql Event Scheduler an alternative to cronjob.

Posted on January 31, 2014 by Suresh Kamrushi in Mysql

Mysql introduce Event scheduler which we can use alternative to Cronjob. There are many advantages over cronjob like:
1) It is directly written on Mysql Server.
2) This is platform independent. Your application might be written in any language it does not matters. You just need to know mysql.
3) We can use them whenever there is a database update or cleanup required at regulare interval.
4) No need to compile queries every time hence performace increased.
5) Error can be log in log files.
Syntax:

DELIMITER //
CREATE EVENT eventName
ON SCHEDULE EVERY 1 WEEK
STARTS 'Some Date to start'
ENDS 'End date If any' 
DO
BEGIN
   // Your query will be hereEND//
DELIMITER ;

Here is detail blog how you can configure and create simple Mysql Event Scheduler.

  Comments or questions are welcome  

Tagged as ,