Does this match what you’re seeing?
- Every page shows ‘Error establishing a database connection’
- The error appeared after moving host or changing a password
WordPress can’t log in to its database. The cause is nearly always one of four things.
1. The details in wp-config.php
Open wp-config.php in System Info & Files then File Manager and find:
define('DB_NAME', 'username_wp123');
define('DB_USER', 'username_wpuser');
define('DB_PASSWORD', '...');
define('DB_HOST', 'localhost');
Compare with Account Manager then MySQL Management:
- Database and user names include your account prefix, for example
username_wp123. Missing the prefix is the most common mistake after a migration. DB_HOSTshould belocalhost.
2. The password
If you’re unsure the password is right, set a new password for the database user in Account Manager then MySQL Management and put the same password in DB_PASSWORD. How to change a database user’s password
3. The user’s access to the database
In Account Manager then MySQL Management, open the database and check the user is listed with privileges. If not, add the user to the database with all privileges. Managing database users and privileges
4. Damaged tables
If the front end shows the error but /wp-admin says tables need repair, add this to wp-config.php:
define('WP_ALLOW_REPAIR', true);
Visit /wp-admin/maint/repair.php, run the repair, then remove the line. How to repair and optimise database tables
Still failing?
If the credentials are definitely correct, check the status page for a database service problem, then open a ticket with the help desk.
Everything in this guide works on Traxio’s WordPress hosting: 30 days free, then £0.99 a month.