日期:2014-05-16 浏览次数:20974 次
CREATE EVENT e_test ON SCHEDULE EVERY 1 DAY DO TRUNCATE TABLE test.aaa;
CREATE EVENT tj_groupon.`e_t_GrossProfit_ins` ON SCHEDULE EVERY 4 HOUR STARTS concat(date_format(now(),'%Y-%m-%d'),' 01:50:00') ON completion preserve ENABLE DO call tj_groupon.p_t_GrossProfit_ins(); // DELIMITER ; ALTER EVENT tj_groupon.`e_t_GrossProfit_ins` ON COMPLETION PRESERVE ENABLE; 要使定时起作用 MySQL的常量GLOBAL event_scheduler必须为on或者是1 -- 查看是否开启定时器 SHOW VARIABLES LIKE '%sche%'; -- 开启定时器 0:off 1:on SET GLOBAL event_scheduler = 1; -- 开启事件 ALTER EVENT tj_groupon.e_insert_t_Groupon_order2 ON COMPLETION PRESERVE ENABLE; ALTER EVENT tj_groupon.e_insert_t_Groupon_order_lastmonths ON COMPLETION PRESERVE ENABLE; ALTER EVENT groupon.summary_event ON COMPLETION PRESERVE ENABLE; ALTER EVENT tj_groupon.e_city_sale_ins ON COMPLETION PRESERVE ENABLE; -- 关闭事件 ALTER EVENT event_test ON COMPLETION PRESERVE DISABLE;
------解决方案--------------------
写到crontab里面
------解决方案--------------------
http://topic.csdn.net/u/20091020/22/c51bb709-6dbc-4fd1-b874-077714ed547e.html
另征集定时执行mysql数据库任务方案。