
The most common reason for database connection error in WordPress is the database name and password and the server name.
Login to your hosting server and access the file wp-config.php and download a copy to your desktop. Check the database login credentials and upload the file again.
The issue that I had was the server name was changed in my config gfile. I copied the server name from database login info and pasted it on the php file.
Boom.. I was able to login the back end and my site stated functioning again.
