How to stop a running procedure in MySQL?

五迷三道 提交于 2021-02-08 13:11:16

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!