How do I terminate all processes for a specific user?

Nick Lamb -

To terminate all processes belonging to a specific user. In MySQL you would gather ids with the the following query:

sql> select Id from information_schema.processlist where user="user_name" > ids.txt

Then for loop that file to kill each one.

-----------------------------------------------

With ClustrixDB:

The collection query is very similar:

sql> select session_id as id from system.sessions where user=(select user from system.users where username='<username>');

Example:

sql> select session_id as id from system.sessions where user=(select user from system.users where username='foo'); 
+----------+
| id |
+----------+
| 12289 |
| 13398017 |
+----------+

The kill processes with:

sql> kill 13398017;

You'll see that the killed process is now gone:

sql> select session_id as id from system.sessions where user=(select user from system.users where username='foo');
+----------+
| id |
+----------+
| 12289 |
| 13460481 |
+----------+

If you wanted to kill all processes, just put the recorded ids into a loop and kill them.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk