Fix Error Establishing Database Connection on Dreamhost

Error establishing database connection can be caused by a number of reasons.  Its a common error which can be solved by using the right method listed below.


  1. Incorrect Login Credentials
  2. Corrupted WordPress files
  3. Corrupted MySQL Database
  4. Database server is down
  5. Too much traffic on your site


  1. Check login credentials are correct
  2. Check if plugin corrupted wordpress files
  3. Repair Database
  4. Check with your hosting provider
  5. Upgrade your hosting

Incorrect Login Credentials

WordPress uses MySQL for the Database of the website.  The SQL database is where the majority of the information for your website is stored.  PHP is used to query the SQL database and return the data to load in the webpae.  The Error Establishing Database Connection is usually caused because one of the PHP login credentials is wrong.  There is a PHP file that stores the login credentials for your SQL Database.  If the login credential is wrong like username or database name then you will get this error.

To fix the issue double check all the login credential values are correct.  Demonstration is to show how to confirm values on Dreamhost.  If you are using a different hosting provider you will have to check how to confirm the following values:

  • MySQL Database Name
  • MySQL Host Name
  • MySQL User Name
  • MySQL Password

Process to fix error establishing database connection

  1. Navigate to Dreamhost web FTP:
  2. Check your FTP user
  3. Update FTP user to allow FTP
  4. Login to FTP and check wp-config.php file
  5. Go to Advanced MySQL Database section
  6. Check DatabaseName, HostName, Username, Password for MySQL Database
  7. Edit wp-config.php with correct login credentials

FTP Process

  1. Check your FTP User
  2. Update FTP user to allow FTP
  3. Login to FTP

Check your FTP User

  1. Go to Dreamhost Panel and login to your hosting account.
  2. Navigate to Domains -> Manage Domains
  3. Find your Domain and check the User under Web Hosting Column.  (In the example below user is actuary_admin)

  4. Click Admin name to open edit user section

Update FTP user to allow FTP

  1. Deselect “Disallow FTP”
  2. Enter a easier to remember password
  3. Click Save Changes

**Note:  This is the Username and password to connect to your web server.  There is a second username and password for the MySQL Database. 

Login to FTP

  1. Host = Domain name URL
  2. Enter Username and Password
  3. Folders showing the files on your web server will open
  4. Find wp-config.php file and download a copy to your computer
dreamhost ftp login

dreamhost ftp login

MySQL Login Credentials

These are the details you’ll need to confirm you have the correct login credentials in your wp-config.php file.  Make sure to note down what your hostname, username, databasename and password are.

  1. Navigate to Advanced->MySQL Databases
  2. Check Hostname
  3. Find Database

Navigate to Advanced->MySQL Databases

Check Hostname

For Dreamhost Hostname is typically   Often times hostname is localhost but for Dreamhost its usually so in this example host is

check dreamhost hostname

check dreamhost hostname

Find Database

Next note your database name and user or create a new user if you want by using Actions-> Add a User.

Once you have all the login credential information its time to check that it matches whats in the wp-config.php file.  Remember the wp-config file is what allows your webpages to query information from your database.  Without the right login a connection to the database cannot be made and you’ll get the error.

Check wp-config is correct

Finally you check that the login credentials in your wp-config file are correct.  If they are wrong fix them and should fix the error.