From time to time I am getting error: Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/hotmouse/public_html/includes/functions/database.php on line 19 Unable to connect to database server! Which shutdown mysql until I would have manually restart it, how track which script could cause that and track it down ?
If it is linux server you may install mytop on your server. additional you can increase the number of connection from MySQL configuration file (usually it is my.cnf). Please note it if you increase the number of connection, it may increase your server load depending on the connections. Kailash
Ok, try mysql command SHOW PROCESSLIST; to see if there are some idle processes and debug your code. (mytop actually does show the same information). Some coders have a bad habit of not closing their connections and on some setups the connections will stay idle and reserve connection until they time out.
Like after server gets stuck with that overload all processes becomes idle , so there is no way to understand which one cause that. Can you suggest something else ?
I also experienced the same problem in one of my forum sites. See the home site here... It has more than 168,000 forum posts. How can I solve the connection error database problem?