If you have a website or a blog that you are running, you might have come across the "Error establishing a database connection" message at some point. If you see that in your website, it can ruin your day really bad. You should know that getting such a message is not something that is new and many people have experienced it. Look at some of these tips that will help you fix the error displaying on your website.
If you wake up one day to find that kind of error, it is always advisable to contact your web host provider. This is for the reason that the problem may be emanating from the other side and not from your end. Once you have contacted them, be clear on what is being displayed and the host will be able to help you if it is coming from their end.
If after contacting your web host provider you are assured that there are no suspicious activities from their end, consider checking the files since they might be corrupted. Check the WordPress files since they may be the ones that are causing the error to appear. If you find that the corrupted files may be the cause of the error, connect to your host in order to try and fix the error, click on the "wp-content" option and give another name instead of the one you have been using, to the plugin files.
If you have done the two steps above but the error can still be seen, consider the next step. The problem may be caused by a corrupted database. If the problem comes from the database, then you are supposed to go to the dashboard of WordPress and see what the WordPress asks to be done and do it. Learn more about wordpress at https://www.youtube.com/watch?v=2cbvZf1jIJM.
There are times that you can go through all these troubles but you won't get the website restored as you had anticipated. In cases where you have tried all those, it is advisable to reinstate the default WordPress files. This is not a hard task since you will be required to download another version of WordPress and replace the one you had before with the one you have downloaded. Once you have downloaded a new WordPress and uploaded it, go back to your website and see whether you can still find the error.
The error establishing database connection that you encounter can be fixed by using any of the methods that have been highlighted in this article. If after going through all this trouble you still can't retrieve your website, contact the maintenance mode support, give them details of the areas you have covered and leave them to tackle the problems for you.