As a reseller host, the option to suspend an account is available to you within the WHMCS panel. You may…
An ‘Error Establishing a Database Connection’ happens when your PHP code cannot get access to your MySQL database. That prevents it from getting all the resources needed to load or launch the site’s page. In this post, we’re going to look at the causes of an ‘Error Establishing a Database Connection’ for WordPress and the solutions.
Let’s start with the causes.
There are several things that can contribute to this issue. Here are four of them:
Let’s look at how to six the problem, in six quick and easy steps!
Incorrect login credential is the most common reason you get the error establishing database message. You can check the login credentials for your database by using the wp-config.php file, which you’ll usually find at the root of your WordPress site.
It has four crucial pieces of information:
Here’s a sample of what you should look for:
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'database_name_here' ); /** MySQL database username */ define( 'DB_USER', 'username_here' ); /** MySQL database password */ define( 'DB_PASSWORD', 'password_here' ); /** MySQL hostname */ define( 'DB_HOST', 'localhost' );
All four pieces of information must be correct if a successful connection is to happen.
After verifying that your database credential is correct, move on to the next step. Check if you are currently using the right database host details. This is typically your localhost. In some cases a hosting provider may choose to store databases on a separate server. To verify, contact your web hosting provider.
To check if your username and password are correct and valid, a new PHP file has to be created.
http://www.yoursite.com/testdb.php from your browser. *Note: replace 'yoursite.com' with your website's name'
If the Database Host info is correct but your connection is not, then you can make new credentials. This can be done by creating a new database user.
If all seems in order, it simply means there’s another issue. To identify it, let’s turn to the server. It’s possible that your MySQL server is down due to high traffic on your server. To put things simpler, your Database Host isn’t capable of managing an influx of web visitors (primarily for shared hosting users).
The fastest way to review this is to phone your web host or send a ticket to support and check if your MySQL server is down. If you have other websites on the same server, now is a good time to check them. If they have the same error message, then there’s a common issue that is most likely linked to the server.
If you try all six of these steps and the problem is still not solved, contact your web hosting provider. Ask if there’s a server maintenance or upgrade in progress to secure your website. If they are, your problem is solved. Your website should be back online when they are done.
If not, your WordPress core files may be corrupted. At this point you should most definitely ask your webhost provider for assistance to do a complete backup of your site and install a new copy of WordPress.
Fixing an Error establishing a database connection issue can be a difficult the first time around. However, with the simple and straightforward steps outlined above, you should be well on your way to solving the problem.