i have a problem with my mysql database, i have some errors in my code which means that too many connections have been made to the database and i can't make any more. i'm in the process of checking through the code to fix this, but i need to know how to get rid of the connections which have already been made. also, is there any way using phpmyadmin to see how many connections have been made to my database so i can keep an eye on this in the future and try to prevent it getting to this stage again? thank you karl
yes i do, but i don't know what it is, so if you have a suggestion involving ssh, could you lay it out in really simple terms, thanks
This is what happens with DDOS attacks so you probably have some endless loop in your code hitting the database with queries. If so then knowing the query count or trying to stop them is hopeless because the cpu will go so slow and have lots more to processs. Restarting mysql is what I would do. If you are actually using that much resource and want to try and dig around the queries then your code must be pretty serious. The database wont fall over with a few crap queries
If your new to ssh then its not an ideal way to help with your issue. phpmyadmin will not be able to connect either. Check your cpu usage, if you cant restart mysql on its own then can you restart apache/webserver? Check your web servers error log, if it's php then thats where your likely to find the error
If high number of conections doesn't increase constantly, you may still be able to connect using phpMyAdmin if you catch the right moment. Then you can get the list of all client connections w/ list of operations they're doing using SHOW PROCESSLIST.
This error also occurs if your hosting provider has set a limit on the number of connections per hour per user, and you exceed that.
sorry for not replying sooner, i've been busy today. if this is a DDoS thing, will it be caused by my site (which is very small, consisting of fewer than a dozen pages, or will it be something else? if it is something else, is there anything i can do in the future to try and reduce the likelyhood of this happening. as for the server which the database is on, it's not my server, it's one i have access to through my hosting company. thank you karl
humm... looks like a php persistent connection problem... Persistent connections are SQL links that do not close when the execution of your script ends. When a persistent connection is requested, PHP checks if there's already an identical persistent connection (that remained open from earlier). Persistent connections are efficient if the overhead to create a link to your SQL server is high, for example because the web server does not run on the same computer as the database server. Persistent connections do not give you any functionality that is not possible with non-persistent connections. They were designed to have one-to-one mapping to regular connections. You should always be able to replace persistent connections with non-persistent connections. Look at your php.ini folowing configuration: mysql.allow_persistent = On hope that helps