Home >Database >Mysql Tutorial >mysql环境下批量kill Locked进程_MySQL

mysql环境下批量kill Locked进程_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:30:481243browse

bitsCN.com

mysql环境批量kill Locked进程

 

 周末同事告知某台mysql服务器连接数爆满,登录上去,发现连接数满。shou processlist 发现大量的 insert itno table_name values(xxx,xxx) 被Locked。那就批量kill掉

 

[root@ ~]# mysql -ss -e "show processlist" | grep &#39;Locked&#39; | awk &#39;{print "kill "$1";"}&#39; >kill.sql  [root@ ~]# mysql -uroot -ppasswd <kill.sql

 

 

kill完发现insert 语句又快速增加,这样初步判断应该是有大数据操作,花费大量时间,那就查一下当前线程连接时间

 

mysql>  select * from information_schema.processlist  order by time ; 

 

这里连接时间过长的sql语句就值得怀疑了。这样就轻松找到了原因。

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn