465   MySQL

mysql>select concat('KILL ',id,';') from information_schema.processlist where user='root' into outfile '/tmp/a.txt';
Query OK, 2 rows affected (0.00 sec)
 
mysql>source /tmp/a.txt;
Query OK, 0 rows affected (0.00 sec)

杀掉当前所有的MySQL连接

$ mysqladmin -uroot -p processlist|awk -F "|" '{print $2}'|xargs -n 1 mysqladmin -uroot -p kill
$ mysqladmin -uroot -p processlist|awk -F "|" '{if($3 == "User")print $2}'|xargs -n 1 mysqladmin -uroot -p kill



Leave a Reply

Your email address will not be published. Required fields are marked *