This error occurs when WordPress is having trouble connecting to your site’s MySQL database server. Your database is where all your files live. If WordPress can’t connect to it, your site is most likely going to be down.
The Solution:
Check if wp-config.php checks out
The wp-config.php file contains your login credentials and other essential details about WordPress.
Make sure your username, password, database name, and host server is correct. To do so, hop on over to your root directory and locate the wp-config.php, access it, and make sure this code has your correct credentials in it.
define('DB_NAME', 'database_name');
/** MySQL database username */
define('DB_USER', 'username');/** MySQL database password */
define('DB_PASSWORD', 'password');
/** MySQL hostname */
define('DB_HOST', 'localhost');
Doing this resolves the issue in most cases.
Reach out to your host for help
If the error persists, it’s possible that something have gone south with your MySQL servers or you might have reached their maximum size. In either case, it might be time to contact your web host and ask for a quick fix.