When you see the above message, the problem is clear: WordPress can not connect to the site’s database.

Most times, this common WordPress error is caused by faulty credentials inside wp-config.php.

Check wp-config.php:-
1) This file holds all the login info for the database that you entered at installation (database name, username, password and server).
2) Recheck the credentials. Mostly, issue will be solved here. If it is not solved, then go to the next step.

Access wp-admin:-
Sometimes things go wrong with the database which cause the need for WordPress to fix it. In those cases, when you go to yoursite.com/wp-admin, you will see a different kind of error message stating that your database needs to be repaired.

If that is the case, add the following line to wp-config.php to enable this feature:
define(‘WP_ALLOW_REPAIR’, true);

After that, access http://www.yoursite.com/wp-admin/maint/repair.php to start the process. When you are done, be sure to remove the line from wp-config.php again as other people will be able to access this function otherwise.

Leave a Reply