问题
I called a procedure in MySQL, but it is in an endless loop now! How to stop a running procedure in MySQL? The following is my procedure code:
drop procedure if exists my_proc;
DELIMITER $$
CREATE PROCEDURE my_proc
()
BEGIN
DECLARE VAR INT;
SET VAR=0;
WHILE VAR<10000
DO
INSERT INTO my_table () VALUES ();
END WHILE;
END; $$
DELIMITER;
CALL my_proc();
回答1:
Connect to the server (or use phpmyadmin or something similar) and do:
SHOW PROCESSLIST;
Find the process causing trouble, note its ID and do:
KILL ID_OF_YOUR_PROCESS;
来源:https://stackoverflow.com/questions/33870131/how-to-stop-a-running-procedure-in-mysql