出现死锁可以用存储过程这个给KILL掉BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE thread_id BIGINT;
DECLARE cur1 CURSOR FOR
SELECT ID
FROM information_schema.processlist
WHERE TIME > 120 AND COMMAND != 'Sleep' AND USER != 'system user';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
OPEN cur1;
read_loop: LOOP
FETCH cur1 INTO thread_id;
IF done THEN
LEAVE read_loop;
END IF;
SET @s = CONCAT('KILL ', thread_id);
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END LOOP;