Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MySQL事件不在每1分钟后删除数据_Mysql_Database - Fatal编程技术网

MySQL事件不在每1分钟后删除数据

MySQL事件不在每1分钟后删除数据,mysql,database,Mysql,Database,每1分钟后不进行删除 delimiter $$ create event remove_notify on schedule every 2 minute starts '2020-09-16' ends '2025-09-15' do begin delete from email_verification where timediff(now(),timestamp)> '00:02:00:00' ; end $$; delimiter ; 桌子 '00:02:0

每1分钟后不进行删除

delimiter $$
create event remove_notify
on schedule 
every 2 minute starts '2020-09-16' ends '2025-09-15'
do begin
    delete from email_verification 
    where timediff(now(),timestamp)> '00:02:00:00' ;
end $$;
delimiter ;
桌子


'00:02:00:00'
是错误的时间文字

使用比较运算符一侧的常量和另一侧的列。即

WHERE `timestamp` < NOW() - INTERVAL 2 MINUTE
WHERE`timestamp`
PS.
timestamp
是保留字,请不要将其用作列名(重命名列),或者至少在查询中用反勾号引用它

WHERE `timestamp` < NOW() - INTERVAL 2 MINUTE