I have a MySQL database, which is very often filling with sleep process and I have to open my workbench and then have to kill them to free connections & then it will work fine.

Is there any way I can do that from command line?


To list all sleeping process in your database

sudo /mysql_rms/bin/mysqladmin -S /mysql_rms/var/mysql_rms.sock -p processlist 

Here you will get list of data , among that list the first field is pid.

To Kill all of them

sudo /mysql_rms/bin/mysqladmin -S /mysql_rms/var/mysql_rms.sock -p kill <id1>,<id2>

Id's are nothing but pid which was taken above. You can kill one after one or you can kill all of them at a time by appending them one after one by separating with comma (,).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.