I have 8 connections open in the database and would like to close all of them, is it possible?
What is the MySQL command that does this?
I have 8 connections open in the database and would like to close all of them, is it possible?
What is the MySQL command that does this?
It does not exist directly but you can do this. Run this in MySQL:
select concat('KILL ',id,';') from information_schema.processlist where user='root' into outfile '/tmp/a.txt';
after
source /tmp/a.txt;
Font .
You can also do this:
SELECT GROUP_CONCAT(CONCAT('KILL QUERY ',id,';') SEPARATOR ' ') KillQuery
FROM information_schema.processlist WHERE user<>'system user'\G
Font .
To run from the command line:
mysql -NBe "SELECT CONCAT('KILL ', id, ';') FROM information_schema.processlist WHERE user = 'some_username';" | mysql -vv
Font .