How to Fix the “Error Establishing a Database Connection” in WordPress
This is a common error happening when trying to install wordpress for the first time or when moving from one host to another.
Why do you get this error?
Well in short, you are getting this error because WordPress is unable to establish a database connection. Now the reason WordPress is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. In our experience, the majority of the times this error happens because of some server error. However, there could be other factors as well. Let’s take a look at how to go about troubleshooting this problem.