Finding and Killing Sessions in MySQL

The first step in killing a session in MySQL is to find the id of the session you want to kill. Make sure you are connected to MySQL as a user that has the appropriate privileges for finding and killing sessions. To find the running sessions, execute the following command:

show processlist;

The above query will return the running sessions. The columns in the results include the following: id, User, Host, Db, Command, Time, State, and Info. The value of the id is needed to be able to execute the command to kill the session. Once you have the id of the session you want to kill, the following command can be executed to kill the session. The below assumes the session id is 148.

kill 148;