Getting Error: Warning: mysql_connect() [function.mysql-connect]: Too many connections in
The other day a customer reported trouble with their site. The error they were getting was:
Warning: mysql_connect() [function.mysql-connect]: Too many connections in
I am not sure what really fixed it but this is what I did.
- I logged into phpmyadmin with the root user. In the Processes tab, i killed all processes
- Rebooted by httpd server
- Rebooted my mysqld server. I shut it down for like 5 minutes, then start it back up.
- I put mysql_close() at the end of every mysql_connect() script. mainli on the footer file.
Since then, I haven't seen the error.
- UPDATE: I wanted to know more about this error. In researching I found out what was causing this error. the guilty one was Google. At the time I was getting this error, Google was crawling my site. I was able to find like 15 diffrent Google IP's crawling my site at the same time, which cause an overload on my server. I also added the following code at the end of my scrpt to make sure I close all mysql connection on every page:
* $mysql_connection = whatever variable you use to connect to your mysql.
Check this out, this might help