Skip to content
Help Center Search the help center/
Troubleshooting

My website can’t connect to the database

Your website shows “Error establishing a database connection” when it can’t reach its database. Work through the causes from the top.

Updated 6 Nov 2026

Common causes

1You’ve changed the database user’s password

Check

Did you change the password recently? Then wp-config.php still has the old one.

What to do

Enter the new password in wp-config.php.

2You don’t remember the database password

Check

The password is only shown when the database user is created. You can’t see it afterwards.

What to do

Change the password under Databases › Manage Users in DirectAdmin. Then enter the new one in wp-config.php.

3DB_HOST is set to something other than localhost

Check

Does DB_HOST in wp-config.php say something other than localhost?

What to do

Change DB_HOST to localhost. The database is on the same server as the website.

4You’re connecting from another computer or service

Check

Are you trying to reach the database from your own computer or an outside service? Only the server itself may connect until you allow more.

What to do

Add your IP address under Manage Users › Allow access from › Add Host.

Allow remote connections to your database
5The error comes and goes

Check

Does the website work sometimes and fail at other times? Your hosting may be hitting its resource limits.

What to do

Check the resource usage to see whether the website reaches the limits.

Check your hosting resource usage
EmilLinusMelinda

Need more help?

Email [email protected] or call 08-519 70 666.