Skip to content

Instantly share code, notes, and snippets.

@anytizer
Last active December 29, 2015 19:29
Show Gist options
  • Save anytizer/7717387 to your computer and use it in GitHub Desktop.
Save anytizer/7717387 to your computer and use it in GitHub Desktop.
Events in MySQL (works like cron feature in Linux server)
CREATE TABLE `_dt` (
`dt` DATETIME DEFAULT NULL
);
DROP EVENT IF EXISTS e_minutely;
DELIMITER $$
CREATE EVENT e_minutely
ON SCHEDULE
EVERY 1 MINUTE
COMMENT 'Test the events.'
DO BEGIN
INSERT INTO _dt(dt) VALUES (NOW());
END $$
SET GLOBAL event_scheduler = ON;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment