Changing database password frequently is always good practice to make your store secure and it will protract your store with malware and other hacking attacks.
Below are the steps on how to change the database password in Magento.
1) Connect to your server using cPanel.
2) update the password of the database user and copy it. As we have to update that new password in the local.xml file.
3) Now, go to app/etc and open local.xml using any editor.
4) find below code in the local.xml file
5) Replace your new password in password tag and save the file.
6) Now, Refresh cache and run your domain URL.