How to Fix “Error Establishing a Database Connection” Imprimir

  • connection, cpanel, error, troubleshooting, wordpress, database
  • 0

The message “Error establishing a database connection” means WordPress (or another application) cannot connect to its database. This is usually caused by incorrect database details or a temporary database issue.

Quick Checks

  1. Wait a few minutes and refresh
    Temporary server load can cause this error. Try again shortly.
  2. Confirm the site is otherwise reachable
    If the whole account is down, check cPanel or contact support.

Common Fixes

1. Verify database details in wp-config.php (WordPress)

  1. Log in to cPanel → File Manager.
  2. Open public_html (or the folder where WordPress is installed).
  3. Edit the file wp-config.php.
  4. Check these lines match the database you created:
    • DB_NAME
    • DB_USER
    • DB_PASSWORD
    • DB_HOST (usually localhost)
  5. Save the file and refresh your site.

2. Check the database user and privileges

  1. In cPanel go to MySQL Databases.
  2. Confirm the database and user exist.
  3. Make sure the user is added to the database with All Privileges.

3. Repair the database

  1. In cPanel go to MySQL Databases.
  2. Use the Repair option if available, or open phpMyAdmin, select the database, and choose Repair table on any tables that show as corrupted.

4. Restore from a recent backup
If the database was recently changed or corrupted, restore the latest working backup from Softaculous or your cPanel backup.

When to Contact Support

Open a ticket if:

  • The error continues after checking the details above
  • You are unsure which database belongs to the site
  • You need help restoring a backup

Include your domain name and the exact error message.

Related articles

  • How to View Error Logs in cPanel
  • How to Fix a White Screen or 500 Internal Server Error

Open a Support Ticket


Ha estat útil la resposta?

« Enrere