WordPress may can’t connect database and faild to display anythig, in this tutorial, we discuss two main reasons that cause this problem and provide solutions, you can fix this problem by our steps.
How to fix?
Step 1. Check the WordPress configures on database connection in config.php is correct
Open config.php file in website root path, check code below:
Step 2: If your wordpress configure is correct, check the database host is available or not.
If the database host is not available, you can not connect it.
You also can use follow code to check why wordpress can not connect database.