In today’s article we will learn how to fix an error establishing database connection in WordPress.
Why we see this error ?
This error usually occurs when there is a problem with the connectivity of the database connection or Whenever we update a plugin or theme, it sometimes creates a problem in the connectivity of the database or if we do not provide database information when we install it on WordPress, it becomes such a problem.
How to Fix this error ?
We can fix this error with the following methods to fix the problem we need to go to Public_html and there we will click on the wp.config file and edit it and see that our database information is correct.
First we will check that our database name username and password is correct. To check this we will come to cpanel and click on MySQL database and our database username and password.
we will now check that username and password details in my sql database
We will check and make sure that the information given to Wp.config is correct or incorrect. If there is any mistake, we will correct it.
Now we will go to our website and see if the website is working properly. If the website is running well then it is great and if the problem persists then we have to see if we have not installed any themes or plugins which is causing this problem. To do this we need to go back to the cPanel file manager and open Public HTML then we will go to the Wp content and click on the folder containing the plugin
if you have any new plugins. Installed and immediately after this error occurred, we will deactivate the folder containing this plugin. we will rename the plugin folder as “deactive”This will deactivate the plugin. This will 100% solve the problem.If this problem still does not go away, contact your hosting provider and let them know about your problem. They will solve your problem
Note: Always Make Backup of Your Site to avoid Loosing Your Data