ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest technologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

Using Wordpress? Get our lightening fast Wordpress Optimised Hosting from £1.60 / month

Get Wordpress Hosting

WordPress showing ‘Error Establishing a Database Connection’

If your WordPress website is reporting that there's an error establishing a database connection, you can run through various steps to ensure that the database connection details are setup correctly, that the database exists, and even change the database password if you think that this is the problem.

Check WordPress wp-config.php database credentials

In your WordPress files on your server, there is a file named wp-config.php where you can review your WordPress database connection information.

To access this, the first step is to log into your cPanel account. If you are unsure on how to do this, please view the following help article - 'How to log into cPanel'.

In cPanel, scroll down to the 'Files' section and choose 'File Manager'.

alt text

The file manager has access to all of the files on your server, including your WordPress files which is where we need to view the wp-config.php file.

Using the left directory listing, open the 'public_html' folder and then click onto the folder that contains your WordPress installation.

alt text

Once in the WordPress folder, locate the wp-config.php file and mouse click onto it.

alt text

Choose 'Edit' from the top menu.

alt text

Open the file in the text editor by selecting 'Edit'.

alt text

When the file loads, review the section for the 'MySQL settings'. This will contain the database name, user and password that it has been configured to use in order to gain a database connection. These are shown as in our example:

  • define('DB_NAME', 'example_wp156'); - the database name consists of our example account username 'example' followed by an underscore and the database name alais 'wp156'.
  • define('DB_USER', 'example_wp156'); - the database user, again our example account username and underscore, followed by the database username alais 'wp156'.
  • define('DB_PASSWORD', '9SyPd2((8R'); - the database password.
  • define('DB_HOST', 'localhost'); - the database host, always localhost.
alt text

Please note that your database connection details will differ from what has been shown here.

Check phpMyAdmin for the database

Now that we know what database WordPress is trying to connect to, lets check that the database exists.

Whilst still logged into your cPanel account, scroll down to the 'Databases' section and choose 'MySQL Databases'.

alt text

At the top under the 'Current Databases', you should find your database listed to verify the database as per the wp-config.php file is correct.

alt text

If you do not have any database listed, you will need to create the database and then import your WordPress database into it. The following help articles will assist with these procedures:

By creating a new MySQL database, you will need to update the wp-config.php that was earlier viewed as per the new MySQL database and user that you create.

If you can see your database and you believe that your wp-config.php file is correct, but you are not confident the password is correct, you can change this.

Reset the WordPress database password

A database does not have a password, only the database user that has access does which we can reset.

Whilst still in 'MySQL Databases', scroll further down to the 'Current Users' section. Select the 'Change Password' option on the database user as noted from earlier.

alt text

Type in your new password for the database user in the 'Password' box and repeat again in the 'Password (Again)' box.

Note that there's a 'Password Generator' option if you would like the system to generate you a strong new password.

alt text

Once your new password has been entered, complete the process by choosing the 'Change Password' option.

alt text

Now go back to the earlier wp-config.php file viewed in the 'File Manager' and update the database config with the new password that you've set. Remember to save the changes to the file before closing the window.

This article helps explain the database information that WordPress has been configured to and how to troubleshoot what might be the problem if your website is experiencing an error establishing a database connection.

Using Wordpress? Get our lightening fast Wordpress Optimised Hosting from £1.60 / month

View Plans