How to kill all sessions of an user
How to kill all sessions of an user
mysql configurationintermediate
by MYSQL
14 views
How to kill all sessions of an user
12345678910111213141516171819202122232425
mysql>
show processlist;
+----+-----------------+-----------+--------+---------+-------+------------------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-----------------+-----------+--------+---------+-------+------------------------+------------------+
| 5 | event_scheduler | localhost | NULL | Daemon | 36418 | Waiting on empty queue | NULL |
| 24 | root | localhost | NULL | Query | 0 | init | show processlist |
| 26 | root | localhost | test | Sleep | 376 | | NULL |
| 27 | root | localhost | testdb. | Sleep | 347 | | NULL |
+----+-----------------+-----------+--------+---------+-------+------------------------+------------------+
4 rows in set (0.00 sec)
mysql>
SELECT GROUP_CONCAT(CONCAT('KILL ',id,';') SEPARATOR ' ') 'Run the kill statements ----->>> ' FROM information_schema.processlist WHERE user='root'\G
*************************** 1. row ***************************
Run the kill statements ----->>> : KILL 24; KILL 26; KILL 27;
1 row in set (0.00 sec)
mysql>
KILL 24; KILL 26; KILL 27;
ERROR 1317 (70100): Query execution was interrupted
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id: 28
Current database: *** NONE ***
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)Please to add comments
No comments yet. Be the first to comment!