In some situations, you may find yourself forced to change the database password of your Joomla website. Such situations include:
- Your website just got hacked.
- You gave all the website credentials (particularly the username and the password of the database) to a developer that you no longer trust.
- You have a good habit of changing all your passwords regularly.
So how do you change the password for your Joomla database?
This is a two step process, and we are assuming you are hosting with a company that offers cpanel (if you’re not, then maybe you should consider switching to us!).
Step 1: Change your database password in Cpanel
Here’s how yo do it:
- Login to Cpanel (Typically your cpanel address would be http://www.yourwebsitaddress:2028).
- Click on “MySQL Databases” near the bottom of the page (located under a section called “Databases”).
- Scroll down to the bottom of the page, to the section called “Current Users.
- Click on the Joomla database user.
- Enter the old password and the new password.
- The password is now changed, that’s the good news. The bad news is that your website has stopped working! You need to execute Step 2 immediately to get it back up!
Step 2: Change your database password in Joomla
Here’s how yo do it:
- Connect to your website through FTP.
- Download the file “configuration.php”.
- Open the file “configuration.php” in a text editor, such as Notepad.
- Change the “$password” value to a new value.
- Upload the file, and you’re done!
Now is there a way to change your database password while having no downtime on your Joomla website? Yes there is! All you need to do is do the following:
- Create a new database user in Cpanel.
- Give the user access to your Joomla database.
- Update your configuration.php file to point to the new user (you have to change both the “$user” and the “$password” entries, where “$user” becomes the username of the new user, and “$password” becomes the password of the new user).
- Upload your configuration.php (now your website is connecting by using your new user).
- Now go your cpanel again, and change the password of the user as described in “Step 1″ above.
- Now update your configuration.php to reflect the credentials of the old user with the new password that you just set.
- Upload your configuration.php file, and now you’re done with 0 seconds of downtime!