Home › Knowledgebase › KB-1294

Why is my website showing a database connection error?

Summary

This guide helps you troubleshoot and resolve: Why is my website showing a database connection error?. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

A database connection error means your website application cannot communicate with its database server. When this happens, visitors may see a blank page, an error message such as “Error establishing a database connection,” or be unable to complete actions like submitting contact forms, processing bookings, or checking out an order. This guide explains what typically causes the error and how to investigate it safely.

Remember — If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.

Quick Fix Steps

  1. Refresh your website page after a minute or two. Temporary database connection drops can resolve on their own.
  2. Check whether other sites on the same hosting account are loading. If multiple sites are affected, the database server itself may be down.
  3. Log in to your hosting control panel and verify that your database service is running.
  4. Confirm you have not recently changed your database password, username, or database name without updating your site’s configuration file.
  5. If you recently installed a plugin, extension, or theme, temporarily disable it to see if the site returns.

Detailed Instructions

Check your hosting control panel

  1. Log in to your hosting control panel (for example, cPanel, Plesk, or your host’s custom dashboard).
  2. Look for a section labelled Databases, MySQL Databases, or Database Management.
  3. Confirm that your database exists and is listed as active.
  4. If you see an option to Repair DB or Check DB, run it to identify corrupted tables.
  5. Review your hosting resource usage. On shared hosting plans, exceeding CPU, memory, or concurrent connection limits can cause the database to reject new connections.

Verify database credentials

  1. Connect to your hosting account using FTP or the control panel’s File Manager.
  2. Locate your website’s configuration file. Common examples include:
    • wp-config.php for WordPress
    • configuration.php for Joomla
    • config.php or .env for many custom PHP applications
  3. Download a backup copy of the file before making changes.
  4. Open the file and check the database settings. Look for lines similar to:
  5. define( 'DB_NAME', 'your_database_name' );
    define( 'DB_USER', 'your_database_username' );
    define( 'DB_PASSWORD', 'your_database_password' );
    define( 'DB_HOST', 'localhost' );
  6. Compare these values with the database details shown in your hosting control panel. The database name, username, and password must match exactly.
  7. If you recently reset your database password in the control panel, update the password in the configuration file and save the file.
  8. Refresh your website to see if the error clears.
Incorrectly editing configuration files can break your site further. Always download a backup copy before editing, and only change the database connection details unless you are confident in what you are doing.

Repair or optimize the database

  1. In your hosting control panel, open phpMyAdmin or the equivalent database management tool.
  2. Select your website’s database from the left-hand menu.
  3. Select the tables you want to check, or choose Check all.
  4. From the dropdown menu, choose Repair table or Optimize table.
  5. Reload your website and test key functions such as contact forms and checkout pages.

Investigate recent changes

  1. If the error started after an automated update, plugin installation, or theme change, revert that change if possible.
  2. For content management systems, try accessing the administrative dashboard. If the dashboard loads but the front end does not, a plugin or theme conflict is likely.
  3. Rename the plugin or extension folder via File Manager or FTP to disable it temporarily, then refresh your site.
  4. Check that your website’s scripting language version (for example, PHP version) matches the requirements of your application and installed extensions.
Remember — If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket