How can I close (KILL) connections that take too long to execute using MySQL and PHP
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The solution is to write a Stored Procedure that kills all the connections above some time:
The procedure is pretty straightforward:
Get all the connection IDs with TIME greater then 10, loop through the results and kill them
And you can make a cron task to call the ClearDB() procedure or you can call it every time you open up a new connection like that:
Hope it will help someone 🙂