The “Error Establishing A Database Connection” is appearing and getting very irritating when we transfer our all WordPress files local server to live server. Then we are getting very upset to see such like the error. But it is not so hard to fix.
So, We’ll discuss why this such error come and how to fix it.
First of all, we have to know that why this such error comes. This error is the error connection of database. We have done some mistake when we connect database.
How to create a WordPress plugin for beginners Click Here
Basically when we use WordPress in our localhost server XAMPP then we just add the database name and username as root but we leave blank on password section on wp-config file in our WordPress file. But when we add our WordPress files to live server then we have to add database connection like database name, username, and password which we newly create on the server by clicking MYSQL Databases and add the new database.
But then we do some mistake like we don’t change database details on wp-config file on WordPress in live server.
The other mistake is that we leave “Add User To Database” section. We have to select username and database and add as Privileges.
Secondly, If you are facing this problem on the local server then you have to check database name. If the problem does not solve after that then you have to delete the wp-config.php file and run the URL.
Then you have to see that WordPress wants configuration. Then you add that database and username as “root” and password leave blank. Then run again and make sure that your error becomes solved.
If not solve yet then you have to delete all WordPress files and install again with the new database connection.
For free lifetime hosting click here