DBA Hub

📋Steps in this guide1/1

How to kill a session in mysql

Get the processid for the session:

mysql configurationintermediate
by MYSQL
12 views
1

How to kill a session in mysql

Get the processid for the session:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mysql>
show processlist;
+----+-----------------+-----------+------+---------+-------+------------------------+------------------+
| Id | User            | Host.     | db   | Command | Time  | State                  | Info |
+----+-----------------+-----------+------+---------+-------+------------------------+------------------+
| 5 | event_scheduler  | localhost  | NULL | Daemon  | 35192 | Waiting on empty queue | NULL |
| 24 | root            | localhost  | NULL | Query   | 0     | init                   | show processlist |
| 25 | root            | localhost  | test | Sleep.   | 6    |                        | NULL         |
+----+-----------------+-----------+------+---------+-------+------------------------+------------------+
3 rows in set (0.00 sec)
mysql>
kill 25;
Query OK, 0 rows affected (0.00 sec)
mysql>
show processlist;
+----+-----------------+-----------+------+---------+-------+------------------------+------------------+
| Id | User            | Host.     | db   | Command | Time  | State                  | Info |
+----+-----------------+-----------+------+---------+-------+------------------------+------------------+
| 5 | event_scheduler  | localhost  | NULL | Daemon  | 35192 | Waiting on empty queue | NULL |
| 24 | root            | localhost  | NULL | Query   | 0     | init                   | show processlist |
mysql>

Comments (0)

Please to add comments

No comments yet. Be the first to comment!