1.定时调用 存储过程mysql
DELIMITER $$sql
ALTER DEFINER=`root`@`localhost` EVENT `event_stroke_ArchivesReportDataRefreshDaily` ON SCHEDULE EVERY 1 DAY STARTS '2012-01-01 00:10:00' ON COMPLETION NOT PRESERVE ENABLE DO CALL proc_stroke_ArchivesReportDataRefresh()$$this
DELIMITER ;spa
2.定时执行sql语句server
DELIMITER $$get
ALTER DEFINER=`root`@`localhost` EVENT `event_stroke_ArchivesReportDataRefreshDaily` ON SCHEDULE EVERY 1 DAY STARTS '2013-08-08 14:49:00' ON COMPLETION NOT PRESERVE ENABLE DO INSERT INTO test(OrgID,valuetime) VALUES(3,NOW())$$it
DELIMITER ;io
mysql version V5.5.12event
打开开关test
SET GLOBAL event_scheduler = 1;
SHOW VARIABLES LIKE 'event_scheduler';
可是关机后会还原为off
永久生效,需在my.ini设置以下
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
event_scheduler = 1
重启mysql服务