关闭指定ip的连接:
for i in $(mysql -uusername -ppassword -Bse "select * from information_schema.processlist where HOST like ‘ip_addr%‘" | awk ‘{print $1}‘);do mysql -uusername -ppassword -e "kill $i";done
下文摘自:mysql 清除连接
清除所有连接
for i in $(MySQL -h192.168.10.101 -uwebuser [email protected] -Bse "show processlist" | awk ‘{print $1}‘);do mysql -h192.168.10.101 -uwebuser [email protected] -e "kill $i";done
清除admin的所有连接
for i in $(mysql -h192.168.10.101 -uwebuser [email protected] -Bse "show processlist" | awk ‘{if($2=="admin")print $1}‘);do mysql -h192.168.10.101 -uwebuser [email protected] -e "kill $i";done
时间: 2024-10-26 04:29:48