下面是我的存储过程,已经设置了set global event_scheduler = 1;而且通过日志发现改定时事件执行了,但是没有杀死任何进程。
create event test
on schedule every 1 day
starts '2021-01-12 11:42:00'
on completion preserve enable do
begin
declare v_sql varchar(500);
declare no_more_long_running_trx integer default 0;
declare c_tid cursor for
SELECT concat('KILL ',id,';') FROM information_schema.processlist;
declare continue handler for not found
set no_more_long_running_trx=1;
open c_tid;
repeat
fetch c_tid into v_sql;
set @v_sql=v_sql;
prepare stmt from @v_sql;
execute stmt;
deallocate prepare stmt;
until no_more_long_running_trx end repeat;
close c_tid;
end;