Wordpress: Error establishing database connection issues

Categories Web HostingDatabases Tags web hostingwordpress

If you’ve uploaded Wordpress onto your hosting account and it isn’t working or if you get ‘Error establishing database connection issues’ when you try to visit your website, it might be that your Database log in credentials are incorrect in the wp-config.php file. To fix this problem, follow the instructions below:

  1. FTP connect to your hosting account
  2. Open the wp-config.php file
  3. Make sure your database name, username, password and hostname are correct (you can find instructions below depending on your hosting)
  4. Find the database string below in the wp-config.php file and replace the bold sections with the correct information

// ** MySQL settings - You can get this info from your web host ** //

/** The name of the database for WordPress */

define( 'DB_NAME', 'Database Name' );

/** MySQL database username */

define( 'DB_USER', 'Username' );

/** MySQL database password */

define( 'DB_PASSWORD', 'Password' );

/** MySQL hostname */

define( 'DB_HOST', 'Hostname' );

  1. Re-upload the edited wp-config.php file

Cloud Hosting:

To find your database name, hostname, username and password:

  1. Log in to the Console
  2. Click the domain you want to manage
  3. Click Database
  4. Click 'View Sample DSNs'
  5. In the pop up you'll find log in information for several different database connections

cPanel Hosting:

  1. Log into the Console
  2. Click the domain you want to manage
  3. Click ‘cPanel’
  4. Under ‘cPanel details’, click ‘Manage Account’
  5. Scroll down to ‘Databases’ and click ‘MySQL Databases’
  6. On this page you’ll find the database name
  7. Scroll down to ‘Current Users’ and click on the username you want the credentials for
  8. On the next page you can reset your database password

For cPanel users the hostname is always localHost.

Rate this article