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;

 

相关其它命令:

show processlist\g

show variables like '%sche'\g

set global event_scheduler = ON\g

 

所有的event是放在information_schema.events表中。

你可能感兴趣的:(mysql)