Mysql environment batch kill Locked process weekend colleagues told a mysql server that the number of connections is full, login, found that the number of connections is full. Shou processlist found that a large number of insert itno table_name values (xxx, xxx) are Locked. Kill them in batches.
[Root @ ~] # Mysql-ss-e "show processlist" | grep 'locked' | awk' {print "kill" $1 ";"} '> kill. SQL [root @ ~] # Mysql-uroot-ppasswd <kill. SQL
After kill, we can find that the insert statement is increasing rapidly. In this way, we can preliminarily determine that there is a large data operation, which takes a lot of time, so we can check the connection time of the current thread.
Mysql> select * from information_schema.processlist order by time;
The SQL statements that have been connected for too long are doubtful. This makes it easy to find the cause.