How To Fix “Error Establishing A Database Connection” In WordPress after reset Mysql users passwords
WordPress:Only yesterday, I received one email from my hosting provider about reminding of me the ‘preparatory task of MySql upgrade’ on their server side. They told that current MySQL database passwords are 16 bit password hash and they want to reset the password so that it will become 4i bit password hash.
The email also tell me that , ‘In case, if the password has not been reset to use the 41 byte password hash before 15th November, 2017 then your database driven websites will start throwing the following error message:- MySQL Errors — You must SET PASSWORD/Password hash should be a 41-digit hexadecimal number’.
They have provided one link which assists me to reset the password. That email also told me that, just by replacing the password with the older password also can make this MySQL preparatory task of update better.
Further, the email told me, “you can also reset the password using your existing password itself. Eg, if your existing password is “[email protected]” and while resetting you enter the new password as “[email protected]”, you do not need to update your connection strings but the password format will change from the current 16-byte hash to 41-byte hash.
In order to avoid any interruption in the service, you need to reset the password of all MySQL database users before”.
This means I have to change the password of MySQL database. My website mohanmekap.com being running with self-hosted WordPress platform means that the website is connected with MySQL database for running and retrieving of contents. For this, I have to log in to cPanel first and then enter into hosting side of the website. Then scroll down to reach to ‘Databases’ and then reach to ‘MySQL Databases‘.
Then, right click on ‘MySQL® Databases’ and open in a new tab. It manages large amounts of information over the web easily. MySQL databases are necessary to run many web-based applications, such as bulletin boards, content management systems, and online shopping carts. For WordPress, all those articles, multimedia contents, comments and everything are stored inside MySQL® Databases.
Here you will find information about ‘Create new database’, ‘Modify database’, ‘current database’, ‘add new user’, ‘add user to database’ and at last ‘CURRENT USERS’. Here there are options of the current database and the list of the database should be visible clearly here. At the side of ‘USERS’ you have the name of the database and here I find the name of the database that is currently in use by WordPress. Then, in the ‘Actions’ segment, we have three identifier elements namely, Change Password‘, ‘Rename’ and ‘Delete’.
As my host has asked me to change the password of MySQL® Databases I click on ‘Change Password’ under ‘Current Users’ and change the password. Then, I open my website on the web browser that is mohanmekap.com and only to find out that the web page is saying that “Error Establishing A Database Connection”.
As WordPress runs in the consent of host connecting to the database and retrieves the contents when the user asks for a website on the web browser. As the password of the database is now changed and it is now obvious that my host of the domain is not finding the database so here starts the second step to make your site online again and the error database connection problem to be solved.
How To Fix “Error Establishing A Database Connection” In WordPress after resetting Mysql users passwords:
First, we have to find where WordPress stores information of MySQL database and this is done in a file namely wp-config.php. It is generally situated at the root folder of document directory of your domain name. First, go to ‘cPanel’ and then go to ‘Files’ and then to ‘File Manager’ and right click on the icon and open in a new tab to open ‘File Manager’ tab on a new window.
Now you have reached the root folder of your site. If you have installed WordPress on your primary domain the wp-config.php file should be located in the public_html directory of your hosting account. Now, you have reached the public_html account of yours hosting account. It is generally the index.html location at the root directory. There search for file namely, wp-config.php
Double click on wp-config.php and then save that file to the local computer. Then select that file and then click on ‘Edit’ at the top menu and this will lead to the opening of another window namely, Text Editor‘ and there click on ‘Edit’ located at the base of it and this will open wp-config.php in another window.
There search for /** MySQL database username */
/** MySQL database password */
Above and replace the old password which should be written (xxxxxxxx) with the new password. Save the file and you are done. Wait for few seconds and then open web browser of your choice while connecting to internet and then open your website and this should now open it without any difficulties if you have followed all of these steps mentioned in this article correctly and now with the resetting of new password for MySQL yours site is now up and running and there will be no trace for “Error Establishing A Database Connection” In WordPress after resetting Mysql users passwords. In this manner, we have fixed “Error Establishing A Database Connection” In WordPress after resetting Mysql users passwords.
Database password change screenshot
As webmasters, one should always be aware of such changes as well as some of these complicated tasks when these are known in clarity it becomes another instance of the wonderful exhibition of knowing everything and without taking the help of others.
Database to WordPress is not so very complicated tasks when it should be known in detail and people start using it. Changing of passwords of MySQL databases are also a good practice as these slowly make your database more stringent and stronger and hackers may not be able to hack into your sites easily. With the proper changing of passwords of databases, we could secure our database from prying eyes of hackers and make it most secure for people who are registering with your website.
Slowly, with these tips learning the knowledge to use WordPress is becoming more and more interesting as with due course of time we have found more and more interesting tips and tricks with due course of time we have learnt many of it that make learning and understanding pieces of information more and more secure and easier for organic visitors to browse website.
Originally published at mohanmekap.com on October 22, 2018.