批量杀死 MySQL 连接
Jun 07, 2016 pm 03:08 PM下面简述 2 种方法 ㈠ 巧用 information_schema.processlist mysql select concat('KILL ',id,';') from information_schema.processlist where user='root' into outfile '/tmp/killall.txt';mysql source /tmp/killall.txt; ㈡ 在 Bash 层用 AWK 实现 ①
下面简述 2 种方法㈠ 巧用 information_schema.processlist
mysql> select concat('KILL ',id,';') from information_schema.processlist where user='root' into outfile '/tmp/killall.txt'; mysql> source /tmp/killall.txt;
㈡ 在 Bash 层用 AWK 实现
① 杀掉所有
mysqladmin -uroot -p processlist|awk -F "|" '{print $2}'|xargs -n 1 mysqladmin -uroot -p kill
② 杀掉指定、比如:Rocky
mysqladmin -uroot -p processlist|awk -F "|" '{if($3 == "Rocky")print $2}'|xargs -n 1 mysqladmin -uroot -p kill

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP's big data structure processing skills

The secret of hatching mobile dragon eggs is revealed (step by step to teach you how to successfully hatch mobile dragon eggs)

How to set font size on mobile phone (easily adjust font size on mobile phone)

How to optimize MySQL query performance in PHP?

How to use MySQL backup and restore in PHP?

How to choose a mobile phone screen protector to protect your mobile phone screen (several key points and tips for purchasing mobile phone screen protectors)

What are the application scenarios of Java enumeration types in databases?

How to insert data into a MySQL table using PHP?
