How to Fix “Error Establishing a Database Connection” in WordPress
This WordPress message means your site can’t log in to its database. It is usually caused by incorrect details after a move or password change.
Work through these checks
- Check wp-config.php. In File Manager, open
public_html/wp-config.phpand confirmDB_NAME,DB_USER,DB_PASSWORDandDB_HOST(normallylocalhost) match your database exactly, including the username prefix. - Reset the database password. In Account Manager › MySQL Management, select the database, change the user’s password, and paste the new one into
wp-config.php. - Check the user is attached. The database user must be assigned to the database in MySQL Management.
- Check disk space. A full account can stop the database working. See Disk quota exceeded.
Frequently asked questions
Can a hacked site cause this error?
It can, if wp-config.php was altered. If your details look wrong and you didn’t change them, change all passwords and contact support.