漫漫长路,其修远兮!
分类: Mysql/postgreSQL
2013-01-31 15:29:19
mysqladmin -uroot -p processlist|awk -F "|" '{if($3 == "username")print $2}'|xargs -n 1 mysqladmin -uroot -p kill
mysql> select concat('KILL ',id,';') from information_schema.processlist where user='root'; +------------------------+ | concat('KILL ',id,';') | +------------------------+ | KILL 3101; | | KILL 2946; | +------------------------+ 2 rows in set (0.00 sec) 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)