Get FAST WordPress Support
World’s Fastest WordPress Support Since 2009  
wordpress error establishing a database connection

FIXED Error Establishing a Database Connection WordPress – 3 Easy Steps

Looking to fix WordPress error establishing a database connection?

Your WordPress database is the location of all the data your site needs to function. If your site is unable to access the database, you will quickly see a WordPress Error Establishing a Database Connection on your site online. Seeing this error can cause extreme panic and freak out!

WordPress Error Establishing a Database Connection

The good news is there are some simple things you can do to fix it and get your site up and running smoothly again. Let us dive in and go through some of these items to reverse the WordPress Error Establishing a Database Connection.


Step #1 Contact Your Hosting Company

Sounds like a really basic everybody should know step right? Well it is not in most cases. It is soooo important to understand that you must lean on your host for support when your website is not working and especially an WordPress Error Establishing a Database Connection.

This could be something on their end that is causing it like a server update or migration or just a temporary outage they are experiencing. Always start by contacting your hosting company before you get into troubleshooting yourself. You pay them, SO USE THEM FOR SUPPORT!


Step #2 Verify Database Credentials are Accurate

There is a file inside of your WordPress installation called wp-config.php which contains the details of your database and allows your web server to connect to it and load the data within.  See an example of this below. This file sits in the lowest folder of your WordPress installation.

// ** 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' );

Now we suggest you verify these details are correct by simply contacting your host and asking them for the database name, database username, database password and database host name. If you are fortunate enough they will give them to you but it is likely, they will simply guide you to the area inside of your hosting account where you can grab them up yourself.

Once you have these credentials, you want to make sure they are correct in the file we mentioned earlier wp-config.php. To access this file you can use an FTP manager or a file manger interface inside of your web hosting control panel.

Hosting control panels vary from host to host so you may need to ask them how to edit the wp-config.php inside of your hosting control panel. Once you get there verify if the credentials are correct and not, correct them and you will surely see the Establishing a Database Connection error go bye bye.


Step #3 Make Sure Database Prefix is Correct

There is another setting inside of the wp-config.php file that if set wrong will cause the Establishing a Database Connection error. This is the database prefix setting. See an example below.

$table_prefix  = 'wp_';

So since we are already editing this file in the last step, let us take a look at what the setting for the database prefix is. Again you can ask your ask for what the prefix should be or they may guide you how to get that answer. Once you have it, verify it is correct and if not, correct it.

WOOHOO if this needed to be changed and you did your magic, the WordPress Error Establishing a Database Connection will be in your past.


So if you have gone through all these steps and still no luck, we would love to help you out further. Comment below and we will see what we can do.

👋WE CAN FIX THIS NOW

Leave a Reply

Your email address will not be published. Required fields are marked *