This error occurs when WordPress is unable to make a connection to the database. A number of things can affect your WordPress database connection which makes it a bit difficult for beginners to troubleshoot.
All of the information on your WordPress site, such as post data, page data, meta information, plugin settings, login information, etc. is stored in your MySQL database. The only data that isn’t stored there is media content such as images and your theme/plugin/core files such as index.php, wp-login.php, etc. When someone visits your website, PHP executes the code on the page and queries the information from the database, which then displays it to the visitor in their browser.
Sometimes this can be resolved by just resetting the username and password. Sometimes it could be a hosting information issue. You can watch the video below to find a solution for this problem. or you can check this Post, hope this post will help you.