Forum Moderators: coopster
I log the error to a file and email myself a message that includes this code whenever there's a connect error:
mysql_errno()." ".mysql_error()
Here's what that code outputs when there's an error:
2003 Can't connect to MySQL server on 'dbserver_here' (49)
I wonder if anyone else has run into this. I have written plenty of code to make my site less reliant on the database, since hosting outfits seem unable to provide reliable mysql database access. Am I the only one experiencing this?
Also, have you considered switching web hosts? You might get better uptime for your databases with someone else.
Just a thought.
I have been through a number of hosts and switching is always an option. My present host has been very responsive, and I'm not sure that they're at fault, so I'm reluctant to leave and risk ending up at a worse outfit.
My next stab at a solution will be to modify the code to make the connection first thing in the code for the page, rather than in code that's executed near the end of the page. I don't see any reason why that would help, but what the heck, I'm short on ideas to try.
You can see what your hosting provider has it set at by running this command ...
SHOW VARIABLES;
Usually, if you are certain your code is written tight and operating as designed, problems come down to configuration/server changes.