When a site drops to a bare page reading Error establishing a database connection , WordPress has already given up: it never reached the point where it could load a theme, so the screen you see is the last thing PHP could print. The quickest way to fix a WordPress database connection error is to stop reading that screen and start reading the four constants that produced it. Below are the three realistic routes to those constants, when each one fits, and a full build of the one that hands you the real MySQL error instead of a generic failure.
Three routes to the same four constants, and only one of them tells you why
Every fix ends in the same place: a working DB_NAME , DB_USER , DB_PASSWORD and DB_HOST in wp-config.php . What separates the approaches is how much information you get on the way there.
Route 1: editing wp-config.php through the hosting file manager
This is the default on shared hosting.β¦