Customising hte "Unable to connect to database server" error message
Janner - November 30, 2006 - 09:56
I just got the "Unable to connect to database server" error message on one of my sites.
No big deal with the error, as it was just a short server glitch, and everything was back working again in a few seconds.
However, I didn't think the content of the error message was what I would want regular visitors to the site to see.
Apart from giving some details about my database (username and database server name), it gives links to installation and upgrade documentation.
Basically, it doesn't look too 'professional'.
So, is there anyway to customise this to something more suitable?
I know there are ways to customise the 403 and 404 error pages, but what about this one?

Same problem
Hallo, I get the same error once in a while and would be very grateful for a hint how to customize this error page.
I've found a solution that works for now but is probably not a "clean" solution:
The error message gets built in database.mysql.inc. I just changed the text to what ever message is wanted instead of the original one.
This helps for now, but a cleaner solution would be nice (I mean without going into a main script). It would be also nice if somebody could give a list of reasons why the connection can fail on a shared host even if the site is not very bussy.
Ummm, yea
I could not find an answer to the question posed here, so I thought Id bump this old thread.
This really is a serious security problem.
http://profitlabinc.com
I get this error too often
Hi,
This error keeps on recurring...
You say "once in a while", but in my experience it shows about every 5 page requests.
Instead of shwoing a different error, i'm looking for a sollution to avoid the error. What could be causing this mysql-connection problems? I never had any problems connecting to my databases, using my own PHP scripts of using the PEAR module DB or MDB2...
Do all Drupal users suffer from this connection problem?
Is this problem a Drupal specific problem, or can my configuration be optimized to stabilize my Drupal MySQL connection?
Thanks!
security issue
i agree that this is a security issue. no matter how helpful a message like this is to an untrained user, it shouldn't be displayed on a public site ever.
would it make sense to use the settings on error-reporting page to determine whether or not to display the information on this page?
Edit this file...
includes/database.mysql.inc - the message is in there and and can be easily edited.
http://profitlabinc.com
I'm getting this error a lot too lately
It's helpful to be able to edit the error message, but it would be *really* helpful to fix whatever the root problem is. Anyone have any ideas? I'm finding my site performance (it's a small site) to be really poor as well of late. I'm assuming the two problems are related...
Related page
There's a related thread at http://drupal.org/node/152673 .