Skip to content

Knowledge base

Search every guide

Fixing "Error establishing a database connection"

WordPress can't reach its database; here's how to find out why.

WordPress reads its database details from the wp-config.php file. This error means those details are wrong, or the database isn't reachable.

  1. In File Manager, open wp-config.php and note DB_NAME, DB_USER and DB_PASSWORD. DB_HOST should be localhost on IDX hosting.
  2. In cPanel Manage My Databases, check that the database and the user exist with exactly those names (including the prefix), and that the user is added to the database with all privileges.
  3. If unsure of the password, set a new one for the database user in cPanel and put the same one in wp-config.php.
  4. Just moved the site? Make sure you imported the database.

If the details are all right and the error continues, open a ticket to the WordPress department.