I have this problem too with Godaddy hosting. The MySql server is getting down 90% of the time and when I ask godaddy to fix the problem they reply with this “Try to optimize your code” because it seems that there are database connections that are not being closed which causing the server to get overloaded.
I tried to find about closing database connections in wordpress, and it seems that wordpress doesn’t explicitly close database connections and relies on the PHP server to close them when the script ends.
I have other pages that I have written myself outside wordpress where I use mysql_close() to close the database connection. I was convinced that my own scripts were not the problem since I was not leaving any database connection opened, but if the PHP server also closes the connection that wordpress opens why do I still getting this message
Unable to connect to database : Too many connections
I have found in different posts that Godaddy sucks, I believe it is, but I’m not willing to change a host at the moment since I just bought a one year dedicated server with them and too bad the business is not working fine. I just want to fix the problem with Godaddy to finish the year with minimum losses.
I know there are plenty of people out there with similar problem with Godaddy, I appreciate if anyone could give me a clue how to solve this problem beside having to switch the host. Thanks
Mario Mansour