How do I kill all the processes in Mysql “show processlist”?

后端 未结 23 1905
温柔的废话
温柔的废话 2020-12-04 04:49

Because I see a lot of processes there, and the \"time\" column shows big values for all of them.

23条回答
  •  遥遥无期
    2020-12-04 05:25

    The following worked great for me:

    echo "show processlist" | mysql | grep -v ^Id | awk '{print $1}' | xargs -i echo "KILL {}; | mysql"
    

提交回复
热议问题