杀掉mysql被锁的进程

1、查出被锁的进程:

mysql -uroot -h127.0.0.1 -p*** -e 'show processlist'|grep "tablename" |grep -v grep|awk '{print $1}'|xargs

 2、把查出来的进程ID放到一个变量中:

arr=(768,358)

 3、循环杀掉被锁进程:

for i in ${arr[@]}; do mysql -uroot -h127.0.0.1 -p*** -e "kill $i"; done

猜你喜欢

转载自arthur2014.iteye.com/blog/2359215