Terminate (kill) a specific session on MariaDB server

MariaDB provides a command to kill a specific session on a server.

Find session ID

First we will identify the session we want to end using any of the queries below:

Option 1 - Show statement

show processlist;

Option 2 - Generic query

select id,
    user,
    host,
    db,
    command,
    time,
    state,
    info,
    progress
from information_schema.processlist;

Result

Kill session

Now we will use the session ID (Id) to kill a specific session (2 in this example):

kill 4;

Result

MySQL ends session and all operations associated with it are aborted if you are not using transactions. This operation could take a while.

Query OK, 0 rows affected (0.01 sec)
Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.