mysql计划任务一例,供大家学习参考。
use dbname
delimiter //
drop event if exists e_Dayly//
CREATE EVENT e_Dayly
ON SCHEDULE
EVERY 1 DAy STARTS '2010-10-19 02:00:00' ENDS '2012-10-19 02:00:00'
DO
begin
insert dbname.productbak (select * from youhuisou.products where (dbname.products.ExpireTime<=NOW()));
delete from products where (dbname.products.ExpireTime<=NOW());
end;
//
delimiter;
其它的相关命令:
所有的event是放在information_schema.events表中。