How to fix error setting up database connection in wordpress

The idea that a database can have a sudden problem usually scares people away from the habit of making regular backups.So, if you are not already doing this, today is the day you will start making regular backups of your WordPress site. Once we have your database backed up and turned on, you can see an easy way to start this article.

Either way, as we get into the troubleshooting part of this post,

it’s important to make sure that you made a new backup before making any changes to your MySQL database or clicking on anything in phpMyAdmin is. Do not overwrite something created before the error message is generated.

What is the error in establishing database connection?

MySQL is an open source database responsible for storing all the important information required by your website. Just to put it, without a database, you get nothing but a blank white screen.

Whenever a visitor comes to your website, WordPress, which is built on PHP, is required to deliver the requested page to your visitor’s browser. To achieve this, WordPress communicates with your MySQL database and requests the necessary information. This includes everything that the end user sees on their screen.

But every now and then, something goes wrong. WordPress goes in search of information and –

nothing. Peace. For whatever reason, WordPress is unable to connect or pull the necessary information from your database. Once this happens, it is up to you or your hosting company to find out the root cause of the problem and fix the error.

It would be nice if the cause of the error was clear as an error message.

Unfortunately, this is rarely the case. Most of the time, the problem can be solved quickly with just a little digging. At other times, you may need to pursue the situation by contacting your hosting company. As you are working through these problems and solutions, remember, as with most things in WordPress, there are usually several ways to solve the same problem.

Your database credentials are incorrect

If you recently installed WordPress through your hosting company’s one-click installer, chances are it is not the cause of your problem.On the other hand, if you are in the process of doing one of the following, then there is a good chance that this is where your problem can be solved:

If you are changing the host or domain name.

Most of the time you will find out if there is a chance that your credibility is wrong. If you are entering or changing database credentials, this is not something you do inadvertently.

The first step towards resolving the error message is to collect all the necessary information. This includes:

This information can be found in your cPanel under MySQL Database (pictured above).

Opening this window will display a list of database installations as well as a list of database users. Keep this window open while going to step number two.

Your second step is to download or open your wp-config.php file. You can do this using a basic FTP program like Filezilla, but it is easy to log into your web page and select “web root (public_html / www)” and then click “Go”.Next, choose the wp-config.php file (as seen above) and click “Edit” at the top of your screen. This will open the file and enable the editor. Scrolling down a few lines gives you the information you are looking for:

 

All the information contained within the citation, for example ‘database_name’,

should exactly match your actual database credentials. Even an extra space after quotes can cause an error message.If you are wondering what your database host should be set up for, you can check with your hosting company’s support team or this list.If you are unsure about your password, you can simply select the user (as seen in the image below) and reset the password.

Leave a Reply

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