I Am Getting a Database Connection Error

Updated 25 February 2026 3164 views Troubleshooting

What Is a Database Connection Error?

The "Error establishing a database connection" message means your website's application cannot communicate with its database server. This is a critical error that typically brings your entire site down since most content is stored in the database.

Common Causes

  • Incorrect database credentials – The database name, username, password, or hostname in your configuration file does not match what is set up on the server.
  • Database server is down – The MySQL or MariaDB service may be temporarily unavailable due to maintenance or an issue.
  • Corrupted database tables – Tables can become corrupted after a server crash, sudden power loss, or a failed write operation.
  • Database user privileges – The database user may not have been granted the necessary permissions on the database.
  • Exceeded database connection limit – If too many simultaneous connections are open, new connections will be refused.

How to Fix It

  1. Verify credentials – For WordPress, open wp-config.php and check these values:
    • DB_NAME – The exact database name as shown in cPanel > MySQL Databases
    • DB_USER – The database username
    • DB_PASSWORD – The password for that user
    • DB_HOST – Usually localhost on shared hosting
  2. Check user privileges – In cPanel under MySQL Databases, scroll to the bottom to confirm the user is assigned to the database with All Privileges.
  3. Repair the database – For WordPress, add define('WP_ALLOW_REPAIR', true); to wp-config.php, then visit yourdomain.com/wp-admin/maint/repair.php. Remove the line when done.
  4. Repair via phpMyAdmin – Open phpMyAdmin in cPanel, select all tables, and choose Repair table from the dropdown.
  5. Check server status – Visit the SillyHost status page or contact support to check if the database server is experiencing issues.

Database connection errors are often urgent. If the above steps do not resolve the issue, contact support immediately for assistance.

Was this article helpful?

Let us know so we can improve our docs.