Web Design and Development
Usually, you only see the Error establishing a database connection message when you are first setting up a WordPress site.1 But this error message can also show up if you receive a lot of traffic or there is a problem with your web host.
Last Thursday, for example, Network Solutions web hosting experienced database outages on ALL Unix servers. And while the problems were being resolved, visitors to many affected WordPress sites saw a blank white screen with a database connection error message.2 Clearly, a custom page instructing visitors to come back later would have been better. So, how do you setup custom database error pages?
WordPress makes it easy to set up custom database error pages. All you need to do is create an error page called db-error.php and save it directly in your
directory. WordPress will automatically detect that it is there and display it when there is an error.
Tip: Make your custom db-error.php file send you an email whenever it is displayed. That way, you will be aware of all database issues that your web host may be having.