Database Connection Failed: Causes and Solutions

The error message "Error Establishing a Database Connection" is one of the most common issues in WordPress. It simply means that WordPress cannot access the database where all your content (texts, settings, passwords) is stored.

1. The Most Common Causes

Most of the time, the problem lies in one of the following three areas:

  • Incorrect credentials: The username or password in the configuration file has been changed.
  • Corrupted database: The table structure contains errors (e.g., after a crashed plugin update).
  • Server overload: The database server is not responding fast enough due to high traffic or load.

2. Step-by-Step Solution

Check A: Verify credentials
Open the wp-config.php file via the cPanel File Manager. Compare the following lines with the data under "MySQL Databases" in cPanel:
  • DB_NAME (Database Name)
  • DB_USER (Username)
  • DB_PASSWORD (Password)
  • DB_HOST (Should almost always be 'localhost' with CURIAWEB)
Check B: Repair the database
If the credentials are correct, the database might be corrupted. Add the following line to your wp-config.php file (just before the line "That's all, stop editing"):

define('WP_ALLOW_REPAIR', true);

Then visit YourDomain.ch/wp-admin/maint/repair.php and click on "Repair Database".
Important: Delete this line from the file immediately after the repair is complete!
Tip: If the error occurs only sporadically, it is often due to insufficient resources. Check your cPanel under "Resource Usage" to see if your hosting package is reaching its limits.

We will bring your database back online

Have you checked the credentials and the repair didn't help? Our support team has direct access to the database servers and will assist you immediately.

Open support ticket for database check
Was this answer helpful? 0 Users Found This Useful (0 Votes)