show processlist中kill锁表语句与慢sql
时间:2021-07-01 10:21:17
帮助过:3人阅读
CleverCode研究了一下,怎么kill掉慢的sql语句。
1 单个kill
mysql> show processlist;
mysql > kill 251;
#批量kill
1)查找Lockd语句
mysql -uroot -p123456 -h 192.1.20.101 -e "show processlist" | grep -i ‘Locked‘ > locked_log.txt
2)组合kill
for line in `cat locked_log.txt | awk ‘{print $1}‘`
do
echo "kill $line;" >> kill_thread_id.sql
done
3)执行
mysql>source kill_thread_id.sql
show processlist中kill锁表语句与慢sql
标签: