This tutorial is part of our tutorial series on WordPress Security. In this tutorial, you will learn how to change your WordPress database password.
How To Change Your WordPress Database Password
If you need to change your WordPress database password, follow the steps below:
Log into your cPanel account …
(Log into cPanel)
Go to cPanel > Databases > MySQL Databases …
(cPanel – MySQL Databases)
Scroll down to the ‘Current Users’ section, select the user account and click on ‘Change Password’ …
(MySQL Database: Users – Change Password)
Change the password. Make sure you choose a very strong new password and copy this password to a plain text file …
(MySQL Databases – Set New Password)
After changing the current user password, you also need to change the password inside your wp-config.php file. Otherwise, you will experience an “error connecting to the database” error.
If you have been following our WordPress maintenance tutorials, you should have a backup copy of your wp-config.php file stored in your hard drive or remote storage location.
You can edit the wp-config.php file by going to cPanel > Files > File Manager …
(cPanel:Files – File Manager)
Or edit a copy of the file and then replace the wp-config.php file on your server using FTP …
Replace the ‘DB_Password’ field in your wp-config.php file with the same password used earlier. Note: Make sure to replace only the string inside the single quote marks and check that there are no spaces or misspelled characters to avoid errors. Save the file to update …
(Change password in wp-config.php file)
Remember to test your site to make sure that everything is working correctly.
Congratulations! Now you know how to change your WordPress database password.
"Learning WordPress has been a huge stumbling block for me. I've been looking for something that covers absolutely everything but doesn't cost an arm and a leg. Thank you so much ... you have just provided me with what I have been looking for! Truly appreciated!" - Tanya
Disclaimer: We have no association with WordPress or any of the products promoted on this site. We may derive financial benefits or affiliate commissions from the sale of third-party products advertised on this website. All images are the copyright of their respective owners, comply with all license terms and agreements of use are used solely for illustrative or training purposes.
Did you enjoy this tutorial? Feel free to share this tutorial with anyone thinking of starting their own business online using the social buttons below.