Q:

Alternate page for mysql connection error

I have a drupal 7 site. Recently I changed my mysql password but forgot to update the settings.php file. My website showed Cannot connect to mysql server for 3 days before I noticed and changed the settings.php file. My question is 
Is there a way to display a custom HTML page (Like a maintenance page) when there is a mysql connection error ? Is there a module for that purpose ?

A:

Having a look in drupal_bootstrap() for D7 it looks like hook_boot comes after the database "phase" so you'd need to put something in the cache phase or the configuration phase if you want to trigger a redirect before Drupal tries to bootstrap the database.
Easiest way would probably be to attempt to open a connection to the database yourself near the bottom of settings.php with the connection string defined earlier in settings.php and then if you detect a fail adapt this approach for "fast 404 pages" - http://2bits.com/drupal-planet/reducing-server-resource-utilization-busy-sites-implementing-fast-404s-drupal.html
You could print some html straight to the screen and exit().

