例子,在linux中操作
$2横向第二栏用户栏
代码如下 | 复制代码 |
for i in $(mysql -uroot -p123456 -se "show processlist" | awk '{if($2=="admin")print $1}');do mysql -uroot -p123456 -e "kill $i";done |
例子,在mysql中解决
代码如下 | 复制代码 |
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) |
时间: 2025-01-21 09:26:48