For regular WordPress website owners, it is a very common tale to get confronted with the Database Connection problem in WordPress. While accessing the WordPress site, shockingly you encounter a blank white screen page having a statement Error Establishing A Database Connection. Though, the situation is quite serious as despite seeing any design or site elements, view a white screen page. The page is blank because no information stored on the WordPress site is being retrieved to render the page. This happens due the database connection lost problem. In fact, not only frontend of your site will break but also you will be prevented from accessing your WordPress Dashboard. Don’t fret! In today’s post, we will walk you through the resolving procedures in a relevant manner. Read and follow easy instructions to get your website back up and running in no disruption.

Common Scenarios Responsible For WordPress Error Establishing A Database Connection

The WordPress Error Establishing A Database Connection means that your website is no longer communicating or has access to your database. When this problem arises, your entire website goes down, and further will directly affect your sales, traffic, and analytics. However, there are a lot more handful of reasons for which WordPress won’t access the information stored in the database. Here’s why such an error message evolved:

  • Your WordPress site uses personal login details to connect to its MySQL database. So, if the database login credentials are incorrectly entered, you can face Error Establishing A Database Connection WordPress.
  • Most probably, the database is corrupt or damaged.
  • Corrupted WordPress files could also result in a database connection error.
  • Too much traffic can also lead to the same error issue.
  • Also, when the database server is down.

Different Solving Guide To Fix WordPress Error Establishing A Database Connection

There are several fixing methods you can try in order to resolve the Error Establishing A Database Connection problem. In the below section, we have compiled a fruitful troubleshooting process to fix the error establishing database connection error. Let’s execute each step seriously and cope with the error in a pinch:

Solution 1: Confirm Your Database Login Credentials

It is extremely required to check your database login credentials. Incorrect login info can trigger WordPress Error in Establishing A Database ConnectionIn general, WordPress stores specific data in a database management system called MySQL. This database is directly stored on a server. To access your WordPress database, a piece of information is necessary to provide:

  • Database Name
  • Username
  • Password
  • Database Server

These are the required database credentials have to give while accessing your site. If you make a single mistake while providing this info, you won’t be able to run your site. Thus, check your WordPress Database credentials via accessing your server’s file. Here’s how:

Check The wp-config File

  • First, launch your host’s cPanel.
  • Select the “File Manager” tab at the top-left corner of the page.
  • Thereafter, opt out of the folder for your website.
  • Now, open the folder for the site you would like to verify.
  • Take a brief look at the file named “wp-config.php.”
  • Once you find it, put a right-click on this option to open it on the screen.
  • You are even advised to download a backup before making any changes to it.
  • Now, you can select the “Edit” tab.
  • Scroll down slightly to find a section labeled “MySQL settings”.
  • Look for the desired information with the database name, username, database password, and hostname.
  • In the end, you’ll need to verify that this information is correctly mentioned or there is any mistake.

Verifying The Database Credentials

  • In your host’s cPanel, click the “MySQL Databases” link.
  • Next, a glimpse of your current databases to validate your database name and username.
  • Thereafter, scroll down to identify the “current users” section. Give a glance on the “Usernames” and “Change Password”. Ensure that they are 100% accurately correct.

Make Sure The Credentials Match

  • If either of these database name, username, and password doesn’t match, make the proper changes properly.
  • Once you correct the info, try reloading the website to check if Error Establishing A Database Connection is solved.

If the same error persists, move to the next solution.

Solution 2: Justify Your WordPress Dashboard

You are recommended to first try launching your WordPress dashboard. Make sure, you add “/wp-admin” to the end of your WordPress site URL while opening the dashboard. For Example:

  • examplewebsite.com/wp-admin

If you yet see the error “Establishing A Database Connection” message, jump to the next solving guide. If you see a different message, follow the prompted guidelines. This could lead you to quickly solve your problem.

If you are able to enter the dashboard, disable plugins, themes, or code until the problem is get finally resolved.

Solution 3: Renovate Your Database

There is a possibility that the database or the recorded files get corrupted. A corrupt database can sometimes create trouble in establishing a strong connection. Thus, it is highly suggested to ensure that no file is damaged otherwise you can confront Error Establishing A Database Connection. Here’s how to check:

  • First and foremost, attempt to log into your WordPress website as an admin.
  • Now, see a message saying something like “One or more database tables are unavailable. The database probably has to be repaired”.
  • At that point, try to repair the database simply by adding a line of code to your “wp_config.php” file.
  • After repairing, open the file and slightly scroll to reach the ‘That’s all, stop editing! Happy blogging’ section. Just above this line, add this code: define(‘WP_ALLOW_REPAIR’, true);
  • Afterward, navigate to the repair page on your website like: examplewebsite.com/wp-admin/main/repair.php.
  • When you browse the repair page, you will have two options or links to check. They are:

ü  Repair Database – When you click on this link, WordPress will look for the common problems and repair them immediately.

ü  Repair and Optimize Database – When you click on this link, WordPress will automatically repair and look for things it can proactively optimize. After optimization, the performance of the WordPress site will be enhanced.

Both can take just a few moments to complete. Anyone can frequently access this page. Once the repairing process gets done completely, remove the code from your wp-config file. Now, try accessing your site to check if the WordPress Database Connection Establishing error has been sorted out. If it is not yet, apply the course of action provided in the next solution.

Solution 4: Make Sure Your Database Server Is Not Down

Nobody expects their servers to go down, but it’s difficult for any server to stay in continuity with having 100% uptime. The server may go down when you use only a single server for web access. If you’re on a cloud-based plan, your site will get diversified from another server if one goes down for any reason. If your website is running on shared hosting, the server may go down due to enough traffic. When this really happens, WordPress Database Connection errors will definitely arise. What you need to do is:

  • First, if several websites are running on the same server, make sure they’re working appropriately. Ensure that no conflict occurs during the site access.
  • Second, if you have a VPS, dedicated, or local server, visit your hosting account and check your server’s current status. If your server is not running or is slow, you might need to reboot it as soon as possible. Rebooting your server might solve this database connection problem.

Solution 5: Reboot Your Server

The shared hosting server doesn’t have the reboot option. Therefore, before attempting to reboot your server, make sure that the server is either VPN, Local, or, Dedicated Server. Only these specified servers, reboot facility is available. Now, here’s the step to follow:

  • First, open your hosting account using the correct login credentials.
  • Now, look for an icon about restarting your server.
  • Once you detect the same, give a single click on it.

Rebooting the server might be helpful in terminating the WordPress Error Establishing A Database Connection problem. If it also doesn’t work, jump to the next solution.

Solution 6: Update Your WordPress Site URL

Another possible reason for the appearance of WordPress Error Establishing A Database Connection could be the WordPress site URL. If none of the above works, it’s always worth checking the URL and updates it if it is necessary. Here’s what you need to follow:

  • First, open the host’s cPanel, go to “Databases” and select the “phpMyAdmin” option.
  • This opens a query editor enabling you to run SQL on your database.
  • Now, first of all, you have to choose your database from the displayed list.
  • Thereafter, select the “SQL” tab and add this line of SQL with your URL:

ü  UPDATE wp_options SET option_value=’examplesite.com’ WHERE option_name=’siteurl’

  • In the end, click the “Go” button. This will update your URL for the database you have chosen. Once it gets done, load your website again to check if the database Connection Error is been solved.

If it doesn’t work out, move to the next solution.

Call Us Anytime At 24/7 Helpline Number For Technical Support

You might have successfully resolved your WordPress Error Establishing A Database Connection problem. If, in case, you are not satisfied with the aforementioned troubleshooting guidelines, dial our toll-free number. One of our talented and well-experienced tech-geeks will lend you an effective hand. The database connection error in WordPress will definitely be eliminated within a few solving tweaks.

 

Ref Link: https://support516895755.wordpress.com/2021/09/25/how-to-quick-fix-wordpress-error-establishing-a-database-connection/