August 26, 2016 at 11:21 am #13556
I’m running a query that worked fine locally when testing, but in the live environment it’s caused the website to crash, with the ‘too many connections’ error.
When I try to stop the query in sqlyog, I get the following error:
Error 1040. Too many connections.
Is there a way to force it to stop, so the site is back to normal?
August 29, 2016 at 12:21 pm #35763
Sibin A SModerator
Hi,This error is returned by the MySQL server since you are running out of connections. The reason would be that you are not closing the connections that you have open.You have to change ‘max_connections’ to increase total permitted connections.You may also refer the MySQL official documentation, here >> https://dev.mysql.com/doc/refman/5.7/en/too-many-connections.htmlPlease note, once the respective value is passed to the ‘max_connections’ variable, ensure that the server is restarted for the changes to come into effect.Regards,Sibin
August 30, 2016 at 12:09 pm #35764
Thanks – through that might be the problem, it is unrealistic; it is already a big site, so the max_concurrent connections is large anyway.
The main thrust of the question though, is how to force a query to stoop – hitting the ‘stop query’ just returned the error and I had no way out of things.
August 31, 2016 at 1:04 pm #35765
Sibin A SModeratorCan you please check the currently open connections. You may execute the below statement to find the currently opened connections,“SHOW STATUS WHERE `variable_name` = ‘Threads_connected’;” and you may also execute “SHOW PROCESSLIST” to verify the number of currently opened connections.Please try increasing the max_connections value and then try, as this is the reason that you get the error. You may also refer the MySQL Official documentation regarding the same, here >> http://dev.mysql.com/doc/refman/5.7/en/too-many-connections.htmlRegards,Sibin
You must be logged in to reply to this topic.