How to change the database password in WordPress?

To set a new password for the database, we first need to create a new password for the user of that database, and we do this in the Databases option in cPanel itself.

cPanel Tools 11 How to change the database password in WordPress?

After that, we will see a list of our databases and the users of those databases. To change the password for the user, go all the way down, and at the bottom of the page, there will be a list of users and a Change Password button. Copy the password, set it, and continue.

Log in to cPanel -> File Manager -> public_html (or your domain folder if it’s not the primary domain)

Find the wp-config.php file, right-click and go to edit. In the code, find:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'cpanel_wrdp1');

/** MySQL database username */
define('DB_USER', 'cpanel_aca1337');

/** MySQL database password */

/** MySQL hostname */
define('DB_HOST', 'localhost');

After entering our password in DB_PASSWORD (without spaces before or after our password), save the changes, and that’s it.

Scroll to Top