WordPress can’t log in to its MySQL database. Usually the database name, username or password in wp-config.php doesn’t match what is in cPanel, or the user was never added to the database, so check those first.
- In File Manager, open
public_html, selectwp-config.phpand click Edit. Note the values ofDB_NAME,DB_USER,DB_PASSWORDandDB_HOST. Copy the file first so you can undo any change. - In cPanel, open Databases → MySQL Databases. The database and user names include your account prefix, such as
account_wp. The names inwp-config.phpmust match exactly, prefix included. - Under Current Databases, check the user is listed under Privileged Users for that database. If not, use Add User To Database, choose both, tick ALL PRIVILEGES and click Make Changes.
- Still failing? Under Current Users, click Change Password next to the user and set a new password. Put exactly the same password in
DB_PASSWORDand save the file. - Make sure
DB_HOSTislocalhost. - Reload the site.
Tip: Avoid single quotes and backslashes in the database password. They break the line in wp-config.php and cause this exact error.
If the details are all correct
- Just moved the site? Open Databases → phpMyAdmin and click the database. If it has no tables, the import didn’t happen. Import your .sql file: see How do I import or export a database with phpMyAdmin?
- Damaged tables. If the dashboard says the database needs repairing, add
define('WP_ALLOW_REPAIR', true);towp-config.php, open yourdomain.com/wp-admin/maint/repair.php and click Repair Database. Remove the line afterwards: anyone can open that page while it is there. - Every site on your account has the error at once and you changed nothing: the database server may be down. Open a ticket marked urgent.
Other applications work the same way: Joomla keeps its database details in configuration.php, and most other apps have a similar settings file.
Still stuck? Open a support ticket with your domain and when the error started (never your passwords), or message us on WhatsApp.
Updated 6 November 2026. Something here out of date? Tell us.