Is there any way to implement a time based trigger in Mysql 5.1?
Is there any way to implement a time based trigger in Mysql 5.1
i.e. it must run at 12H05 every day
Edit
A corn job calling an SQL script is curren开发者_如何学Gotly been used - but I am looking for a less complicated solution.
To do this with Mysql 5.1.x use the following code:
CREATE EVENT myevent
ON SCHEDULE
EVERY 6 HOUR
COMMENT 'A sample comment.'
DO
UPDATE myschema.mytable SET mycol = mycol + 1;
Here link to the users manual
Unless triggers in MySQL are different than in most other RDBMS, a time based trigger makes no sense. Triggers are fired in reaction to rows being added/inserted/deleted in a table. If you want a time based operation to occur, you should be considering a Job (in SQL Server) or Windows Service.
精彩评论