Error establishing a database connection


You may see the following error when visiting your site:

Error establishing a database connection

This error means that your website files (on the web server) 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.

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 any of those are incorrect, your site cannot connect to the database. Standard config files for popular software are shown below:

Software Config file name Config file location
concrete5 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.

See also

Did this article answer your questions?

Article last updated PST.