How to Fix “Error Establishing a Database Connection” in WordPress Print

  • database connection error, wordpress error, wp-config, mysql error
  • 0

“Error establishing a database connection” means WordPress cannot reach its MySQL database. It is one of the most common WordPress errors — and usually easy to fix.


Step 1: Check Your Database Credentials

  1. Open the Plesk File Manager and edit httpdocs/wp-config.php.
  2. Find the lines DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST.
  3. Compare them against the real database credentials in Plesk under Databases — click your database to see its users.
  4. If the password was changed recently, update DB_PASSWORD in wp-config.php to match.

Step 2: Check That the Database Exists

  1. In Plesk go to Databases.
  2. Confirm the database listed in DB_NAME actually exists and has a user assigned with the right password.

Step 3: Repair Corrupted Tables (if needed)

If credentials are correct but the error persists, a table may be corrupted:

  1. In Plesk open Databases → phpMyAdmin for your database.
  2. Select all tables, choose Repair table from the dropdown.

Other Causes

  • Server overload: if the whole server was rebooted or MySQL crashed, wait a few minutes and retry — or open a ticket and we will check the database service.
  • Wrong DB_HOST: it is almost always localhost on our servers.

Ця відповідь Вам допомогла?
Back