Get 30% off your WordPress Hosting with code WPSAVE10. Launch Faster. Save More!
  • 00 Days
  • 00 Hours
  • 00 Minutes
  • 00 Seconds

WordPress staging website (Error establishing a database connection) – Enhance Hosting

If your staged WordPress website shows Error establishing a database connection then it can be fixed quickly like so:

  1. Open the Staged website and go to Databases
  2. Click Users and note the Username
  3. Click Files and then public_html
  4. On the file wp-config.php click the (3 dots) and Edit
  5. Correct the DB_NAME and DB_USER

Finally. update the DB_NAME & DB_USER to the one noted in step 2.

For example, update from this:

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'test_test_example_wp307' );

/** Database username */
define( 'DB_USER', 'test_test_example_wp307' );

To this:

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'test_example_wp307' );

/** Database username */
define( 'DB_USER', 'test_example_wp307' );

This issue is extremely rare and only affects some WordPress sites imported from certain cPanel versions.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to disable PHP error reporting – Enhance Hosting

In this guide, we will learn how to hide or suppress PHP errors and notices such as the common...

How to manage DNS – Enhance Hosting

How to add or edit DNS To add or edit DNS entries: Open Websites in the left sidebar Select...

Add a Staging Site & Push Live – Enhance Hosting

To add a staging website Open Websites in the left sidebar Click Add new Select either Start...

Importing a cPanel backup – Enhance Hosting

The cPanel importer allows you to migrate a cPanel account into your website. To import a...

How to manage FTP accounts – Enhance Hosting

To add an FTP accounts on a single website: On the website dashboard select the advanced...