Is your hosting active? A suspended account shows errors too. In the Client Area, click Services and check your hosting shows Active. See Overdue invoices and suspension.
1. Check the details in wp-config.php
Most often, the database details WordPress uses don’t match the real ones, for example after moving the site or changing a password.1
Open wp-config.php
Log in to cPanel, open File Manager, go to your site’s folder (usually
public_html), and open wp-config.php with Edit.2
Note the database details
Find these lines:
DB_HOST should be localhost.3
Compare with cPanel
In cPanel, open Manage My Databases. Check that a database with exactly the
DB_NAME exists, a user with exactly the DB_USER exists, and that user is listed under the database’s Privileged Users.2. Reset the database user’s password
If the names match, the password may be wrong.1
Set a new password
In Manage My Databases, find the user under Current Users, choose to change its password, and set a new strong password. Copy it.
2
Update wp-config.php
Paste the new password into the
DB_PASSWORD line in wp-config.php, keeping the quote marks, and save the file.3. If the user isn’t linked to the database
In Manage My Databases, under Add User To Database, choose the user and the database, click Add, and tick ALL PRIVILEGES.4. Repair the database
If only part of your site shows the error, or the admin dashboard mentions a damaged database:1
Turn on repair mode
Add this line to
wp-config.php, just above the line /* That's all, stop editing! */:2
Run the repair
Visit
https://yourdomain.com/wp-admin/maint/repair.php and click Repair Database.3
Turn repair mode off
Remove the line from
wp-config.php straight away. While it’s there, anyone can open the repair page.