Page 1 of 1

kill ALL mysql processes

Posted: Thu Mar 15, 2007 3:40 pm
by GeXus
Anyone know how to do this? or at least how to kill all sleep connections

Thanks!

Posted: Thu Mar 15, 2007 3:59 pm
by AKA Panama Jack
They will normally timeout on their own. BTW, if you are using persistent connections you might want to change to normal connections. What with the changes in how Mysql works persistent connections are not faster and do not save any processing time but they do eat up memory and can cause mysql to run out of available connections. This will cause the some people to see the too many connection error when they try to access the site.

If you are using persistent connections you really should stop. Honestly the only reason I think they still keep it is for backwards compatibility.

Posted: Thu Mar 15, 2007 4:05 pm
by GeXus
i use mysql_connect and close all connections at the end of the script.. is that what you mean?

These current processes have been running for a while now, there are about 300, most of which are in sleep.. it seems that i can only have 3 threads going at a time... can I increase that?

Posted: Thu Mar 15, 2007 4:10 pm
by GeXus
Also, just to add if i can kill all processes by user, that would work just fine as well.

Posted: Thu Mar 15, 2007 4:29 pm
by veridicus
Be careful killing mysql processes. Killing all with -9 has the potential to corrupt your database files.

Posted: Fri Mar 16, 2007 2:37 pm
by GeXus
Just wanted to come back to this, i have tons of sleeping processes still and no where can I find out how to kill them all.. or disable them.. I'm not entirely sure what this even means, i just know that my server seems to be running quite slow and i have all these processes running.

Is there an ideal way to setup everything if it will be highly transactional to prevent this from happening in the future?

Posted: Fri Mar 16, 2007 2:40 pm
by pickle
Restart the MySQL server?

Posted: Fri Mar 16, 2007 4:04 pm
by GeXus
Can't restart without killing all processes :p

Posted: Fri Mar 16, 2007 5:31 pm
by GeXus
Okay, I was able to kill all processes using

Code: Select all

ps ax | grep mysqld

then

kill -9 PID#

Now the question is how to prevent sleeping threads from occurring in the future!