阅读背景:

杀掉mysql被锁的进程

来源:互联网 

1、查出被锁的进程:

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

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
}'|xargs mysql -uroot -h127.0.0.1 -p*** -e 'show


你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: