Are you seeing the ‘Error establishing a database connection’ notice on your WordPress website? It is a fatal error that makes your WordPress website inaccessible to the users.
The ‘Error establishing a database connection’ issue can be caused by incorrect database information in your WordPress settings, corrupt database, or an irresponsive database server.
In this article, we will show you how to easily fix the error establishing a database connection in WordPress.
A database is a software which makes it easy to store, organize, and retrieve data into other software.
As a content management system, WordPress uses a database to store all your content and other website data. It then connects to the database each time someone visits your website.
WordPress needs the following information for connecting to the database:
- Database name
- Database username
- Database password
- Database server
This information is stored in your WordPress configuration file called wp-config.php.
If any of these items are incorrect, WordPress would fail to connect to your database server, and you’ll see the ‘Error establishing a database connection’ error.
It is one of the most common WordPress errors. Apart from incorrect credentials.
Let’s take a look at how to fix error establishing database connection issue in WordPress with step by step troubleshooting.
The most common reason for database connection error in WordPress is incorrect database credentials. If you have recently moved your WordPress site to a new host, then this could be the most likely reason.
Your WordPress database credentials are stored in the wp-config.php file. It is the WordPress configuration file that contains important WordPress settings including database information.
You’ll be looking for the following lines in the wp-config.php file.
You need to make sure that the information for the database name, username, password, and database host is correct.
You can confirm this information from your WordPress hosting account dashboard. Simply log in to your hosting account and click on MySQL databases under the database section.
This will take you to the database management page in your hosting dashboad. From here, you can find out your database name and the username.
Once you have confirmed your database name, username, and password, you can change that information in your wp-config.php file if needed.
Watch Video Tutorial
After that, try visiting your website again to see if the database connection error has gone.
If you can still see the error, then this means that something else is wrong. In this case, no need to be panic all you need to do is login to your HarmonWeb client area and open a support ticket and one of our technical team will help you fix it immediately.