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?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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 (,).