KNOWNHOST KNOWLEDGE BASE

Hosting Question? Find the Solution - Browse our Guides, Articles, and How-To's

How to update your wp-config.php file with a new database password?

WordPress is an open-source content management system. It is more popular due to versatility and the community contribution towards wordpress to make it a multipurpose platform. In some cases, WordPress might get affected by malicious code/plugin leading to a whole cPanel compromise; in that case, we always recommend removing the affected plugins, themes and the files related to the event of compromise along with changing database password. Learn, How to update your wp-config.php file with a new database password?


Using cPanel

1. Log in to cPanel using Username Password. i.e; (https://yourdomain.com:2083 or https://yourdomain.com/cpanel)

2. Navigate and open Files → File Manager.

3. Next, navigate to WordPress installation directory. In our case that is public_html/wp.

navigate to wordpress root directory

4. Righclick on wp-config.php Click on Edit.

edit wp-config cpanel

5. Enter the new database password in DB_PASSWORD (as shown in the image) Click on Save Changes,

how to change wordpress database password in cpanel wp-config

Congratulations! You have successfully updated the new database password for the WordPress website.


Using DirectAdmin

1. First, to login into DirectAdmin control panel visit, 

https://your-domain.com:2222 or https://IP-address:2222 or https://server-hostname:2222.

login-into-directadmin

2. Navigate to System Info & Files → File Manager.

navigate-to-file-manager-directadmin

3. Next, navigate to WordPress installation directory. In our case that is public_html.

wordpress install directory directadmin

4. Select wp-config.php Click on Edit.

select wp-config file click on edit

5. Enter the new database password in DB_PASSWORD (as shown in the image) Click on Save.

how to change wordpress database password directadmin wpconfig

Congratulations! You have successfully updated the new database password for the WordPress website.


Conclusion

Now that we’ve gone over how to update your wp-config.php file with a new database password in the event of website compromise. We have covered both control panels (cPanel & DirectAdmin) with step-by-step instructions to update the password in the wp-config.php file.

KnownHost offers 365 days a year, 24 hours a day, all 7 days of the week best in class technical support. A dedicated team ready to help you with requests such as adding new password protected directories; should you need our assistance. You’re not using KnownHost for the best webhosting experience? Well, why not? Check with our Sales team to see what can KnownHost do for you in improving your webhosting experience.