我想在我的MYSQL中每10分钟执行一次这个事件,但是任何人都不建议这样做

时间:2017-07-07 06:54:44

标签: mysql

DELIMITER $$

DROP EVENT IF EXISTS delete_name $$

CREATE DEFINER=`root`@`LOCALHOST` 
EVENT `delete_name` 
ON SCHEDULE EVERY 10 MINUTE starts now()
ON COMPLETION NOT PRESERVE ENABLE
DO 
BEGIN
DELETE FROM CLTX_SOFS WHERE STR_TO_DATE(CONCAT('2017-07-07',' ','11:30:00'),'%Y-%m-%d %H:%i:%s') < (NOW() - INTERVAL 10 MINUTE);
END $$

1 个答案:

答案 0 :(得分:0)

顺便提一下,请注意

STR_TO_DATE(CONCAT('2017-07-07',' ','11:30:00'),'%Y-%m-%d %H:%i:%s') 

相当于

'2017-07-07 11:30:00'