Knowledgebase

Error establishing a database connection Print

  • database, errors, cpanel, wordpress, migration, troubleshooting, php, password, downtime, support
  • 0

The application could not reach its database.

WHAT IT MEANS

The credentials are wrong, the user lacks access, or the database server did not respond.

CHECK THE CREDENTIALS FIRST

Compare the configuration file against cPanel > MySQL Databases.

Remember the prefix: both the database name and the username carry your cPanel username followed by an underscore.

Forgetting the prefix is the single most common cause.

IN WORDPRESS

The values are in wp-config.php: DB_NAME, DB_USER, DB_PASSWORD, DB_HOST.

DB_HOST should be localhost.

CHECK THE USER IS ASSIGNED

cPanel > MySQL Databases. The user must be added to the database with ALL PRIVILEGES.

A user that exists but is not assigned produces this.

IF YOU ARE UNSURE

Create a new database user, assign it with all privileges, and update the configuration. It takes two minutes and eliminates the possibility.

AFTER A MIGRATION

The most common post-migration error. The old credentials came with the files and do not exist on the new server.

IF CREDENTIALS ARE DEFINITELY CORRECT

Open a ticket. The database server may be unreachable, which is ours to check.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot