How To Fix WordPress Error Establishing A Database Connection?

How To Fix WordPress Error Establishing A Database Connection?

userPosted by Mason Lava

Being a WordPress website developer, the situation can be too terrible for you when you are suddenly unable to access your site for any reason. You can be sometimes prevented from being, accessing your WordPress website just because of the Error Establishing A Database Connection WordPress. This is the most common as well as a serious problem most users come up-front usually when WordPress is not able to make a proper connection to the database.

A number of important things can get affected if the connection is lost between WordPress and Database. That’s why; it is required to immediately take an action for solving the error by establishing a database connection in WordPress. In this guide, you will learn the right ways to fix the error. Thus, read it out!


How To Fix WordPress Error Establishing A Database Connection?

So there can be ample reasons why “ Error establishing a database connection in WordPress occur”. A few of them are  given below:

  • Wrong database in your WordPress Settings
  • The corrupted WordPress files trigger a database connection error
  • Corrupted database
  • When the database server is down, such issues may occur
  • When there is too much traffic on your Website 


What Information does WordPress require?

  • Name
  • Username
  • Password
  • Server


Solutions To Quick-Fix WordPress Error Establishing A Database Connection

Since we value your precious time, that’s why without any delay we are going to describe the effectual solutions below so that you can in the pinch fix the WordPress Error Establishing A Database ConnectionLet’s take a brief look at once and follow the provided directives in an appropriate manner:

WordPress Error Establishing A Database Connection


Solution 1: Check Your Database Login Credentials

WordPress Error Establishing A Database Connection

WordPress is one of the prominent open-source management systems that use a database to store all the product content and website details. Also, it is one of the key facts for establishing a database connection and correct login credentials. 

Therefore, when you press an incorrect either database username or password, the WordPress Error Establishing A Database Connection will arise. Hence we suggest you first check your database details like your name, username, password, and database host for 100% correctly inserted.  However, you can confirm all this information directly from your WordPress hosting account dashboard.


Here is what to do:

  • Please log in to your hosting account
  • Then, select the “Databases” option from the left panel
  • Now, give a single click on the “MySQL Databases” link.
  • You will be directly landed on the database management page. Thereon, you can find out your database name and username.
  • Find the database users and links to change the password.
  • Now Change the database information in your wp-config.php file whenever it is required.
  • Afterward, visit your WordPress website to check if the Database Connection Error is resolved.

If you’re still facing the same error, you can do various things. Continue reading to find the next solving guide.


Solution 2: Check Your Database Host Information


When it is confirmed by your end then the complete information related to the database is correct, you ensure that you are using the correct database host information. Numerous WordPress hosting companies use localhost as your database host.

However, some managed WordPress hosting companies use specific servers to host databases. In such conditions, your database host information will not be localhost. For that, you should contact your WordPress hosting company— to ensure your database host information.


Solution 3: Check If Database Server Is Down

WordPress Error Establishing A Database Connection

If everything is correct but unfortunately still facing the Error. When you establish a Database Connection WordPress, then probably your database server (MySQL server) is down. This could happen most of the time because of heavy traffic on the server.

Generally, your host server cannot handle the load specifically the time when you are on shared hosting. Your site will go slow and for some users, it may even result in a database connection error. Therefore the best thing you should do is get on the phone or live chat with your hosting provider and urge them for your MySQL server to be responsive.


Solution 4: Update WordPress Site URL

WordPress Site URL

Another possible solution you are suggested to do is updating the WordPress site URL using phpMyAdmin. Here is how: 

  • Simply access phpMyAdmin from your hosting account dashboard, and select your WordPress database to check the URL for updates.
  • Afterwards, place a click on the “SQL” menu on the top and enter the following MySQL query. UPDATE wp_options SET option_value=’YOUR_SITE_URL’ WHERE option_name=’siteurl’

So please don’t forget to mention your site URL and change wp_options to your table name as you may have changed the WordPress table prefix. If you can connect to the database, the problem has been resolved. But if yet won’t connect, continue fixing using the next solving guide.


Solution 5: Rebooting Web Server

Rebooting Web Server

Users on dedicated servers, local servers, and virtual private servers (VPS) can simply try rebooting their Web servers.  It will soon restart your web and database server, which may fix some temporary glitches including the error establishing a database connection.


Solution 6: Eliminate Corrupted Plugins And Themes

WordPress files may get corrupted due to outdated plugins or themes. Therefore, you can update your WordPress and remove the damaged plugins or themes if find any. However, you can remove the corrupt files via FTP or by accessing the files in the host’s admin panel.

To access the files, first, open cPanel, go to the “Files” menu and select the “File Manager” tab.

  • If you’re using the main site on your server, look for the “public_html” tab and click on it
  • If you’re using another site on your server, look for the folder with the site’s name
  • Afterwards, seek a folder named “wp-content” and give a click on it
  • Now, search for the folders for your themes and plugins. Rename the folder you suspect if any is the culprit. Now, remember, to consider the quality of your themes and plugins

If after renaming the folder of plugins and themes and the same problem persists, plugins and themes are not the problems. Try out the next solving guide.


Solution 7: Replace Fault WordPress Files

  • If, in case, your WordPress files are corrupt, download a fresh new copy of WordPress and unzip it. Here’s the step you need to go through:
  • First of all, remove the “wp-content” folder and also delete the file called “wp-config-sample.php”.
  • Finally, upload the fresh files to the WordPress root folder.
  • This will overwrite all files except the two you have recently deleted.
  • Now, access your WordPress site to see if it solves your WordPress Error Establishing A Database Connection problem.


Solution 8: Contact Your Web Host Provider

If nothing else works, it’s high time to make a direct connection with your Web Host provider. Contacting your host for instant support is the ultimate decision for anyone unable to fix his/her issues. You can grab fast-reacting support from the host via live chat.  Also, you can frequently raise a query in front of the host team that you are experiencing a Database Connection error. They will help you resolve your error in a short span, it is 100% guaranteed.



We hope the above guide is very helpful in resolving the Error Establishing A Database Connection WordPress. In case the issue persists, feel free to reach out via 24*7 online WordPress Support Number. 

We are an efficient team of highly proficient and well-educated engineers who better understand how to deal with customer queries.  Hence, there is no confusion left and we can resolve your issues in a fraction of seconds.

Tagged with:
  • On Time Delivery

  • 50


  • 24×7 WordPress Support

  • Cost Effective Services

  • Skills Wordpress Developers

  • 100% Satisfaction