Error establishing a database connection

Overview

You may see the following error when visiting your site:

Error establishing a database connection

This error means that your website files (on the webserver) are not able to connect to your database (on the database server). This article lists some common reasons this error could display on your site, including:

Incorrect database credentials in your config file

Every website that connects to a database has a config file. This config file stores the following database credentials which allows you to connect.

  • Database username
  • Database username password
  • Database hostname
  • Database name

If the database login information was changed in the panel without updating the connection information in the site's configuration file, your site cannot connect to the database. Standard config files for popular software are shown below:

Software Config file name Config file location
Concrete CMS database.php application/config/
Joomla configuration.php In the site's main directory
MediaWiki Localsettings.php In the site's main directory
phpBB config.php In the site's main directory
WordPress wp-config.php In the site's main directory
Zen Cart configure.php includes/

Where can I find my database credentials?

View the following article for instructions on how to locate your database credentials:

Never use localhost for your hostname. You must only use the hostname set up in your DreamHost panel.

The hostname isn't working

The hostname is the URL you use to access your database. View the following article for instructions on how to locate this URL in your panel.

First, test the hostname by trying to access it with a web browser. If nothing loads, then you likely have an incorrect hostname and you'll need to replace it with a functioning one. Luckily, hostnames on the same server are interchangeable, so if you have another hostname that does work on the same server, you can just use the one that works. If you have no other hostnames for that server, you will need to create one and wait for it to propagate. View the phpMyAdmin article for further details.

If the hostname loads, you will be prompted for a username and password. If the username and password from the config file are rejected, you may need to update them with the correct information. View the following article for details on how to obtain the correct credentials in your panel.

The database server is unavailable

It's possible your MySQL server is not responding due to networking issues. If you see an error when attempting to connect to phpMyAdmin, contact support for further assistance.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?