Chinaunix首页 | 论坛 | 博客
  • 博客访问: 59286
  • 博文数量: 16
  • 博客积分: 354
  • 博客等级: 一等列兵
  • 技术积分: 180
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-14 18:00
文章分类

全部博文(16)

文章存档

2012年(1)

2011年(15)

分类: Mysql/postgreSQL

2011-10-18 17:17:42

有时需要根据连入mysql的用户名,将这些连接都杀掉,例如杀掉thunder用户所有的连接,可以执行:

mysql.local -s -e"show processlist"|awk -F "\t" '{if($2=="thunder")print $1}'|xargs -n 1 mysqladmin.local kill

另外,也可以杀掉除了mysqlsync和root用户以外的连接:

mysql.local -s -e"show processlist"|awk -F "\t" '{if($2!="mysqlsync" && $2!="root")print $1}'|xargs -n 1 mysqladmin.local kill

阅读(1998) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~