You might need to change a database password after a security scare, when a developer leaves, or because nobody remembers what it was. This guide shows how to change a MySQL database user's password in an Instant Access Internet Services cPanel account and, just as important, how to update your website's settings so it can still connect afterwards.
Before you start
Changing the password breaks the connection until you update your site. The moment you save a new database password, any website using that user will show an error such as "Error establishing a database connection" until you put the new password into the site's configuration file. Have File Manager ready and do both steps together.
Database users are separate from your cPanel login, your email accounts and your WordPress admin users. Changing a database password doesn't affect any of those. (To reset a WordPress admin password instead, see the related guide below.)
Step 1: Find which database user your site uses
For WordPress:
- In cPanel, go to Files > File Manager and open
public_html(or the folder WordPress is in). - Right-click
wp-config.phpand choose View. - Note the values of
DB_NAMEandDB_USER, for exampleusername_wp123.
Other applications keep these settings in their own file, such as configuration.php (Joomla), .env (Laravel) or config.php. Check your software's documentation if you're not sure.
Step 2: Change the MySQL user's password in cPanel
- In cPanel, go to Databases > Manage My Databases.
- Scroll down to the Current Users table.
- Find the user from Step 1 and click Change Password next to it.
- Type a new password in both boxes, or click Password Generator to create a strong one. Copy the password somewhere safe before you continue.
- Click Change Password.
You'll only ever type this password into a config file, so a long random one is best. Avoid quote marks (' and ") and backslashes, which can break config files.
Step 3: Update your website's configuration file
- Go back to Files > File Manager, right-click
wp-config.phpand choose Edit. - Find this line:
define( 'DB_PASSWORD', 'old-password-here' ); - Replace only the text between the quote marks with your new password. Leave the quote marks, comma and semicolon exactly as they are.
- Click Save Changes.
- Load your website to check it works.
Troubleshooting
"Error establishing a database connection" after the change
The password in wp-config.php doesn't match. Check for extra spaces or a missing quote mark, and that you edited the right file (the one in the folder your site actually runs from). If you're unsure what you typed, simply change the password again in cPanel and paste the same value into the config file.
The database user isn't in the Current Users list
Check the full name, including the prefix (the part before the underscore, which is your cPanel username). If the user really doesn't exist, create a new user and add it to the database with ALL PRIVILEGES (see the database guide below), then put the new username and password in your config file.
Does this change my phpMyAdmin login?
No. You open phpMyAdmin from cPanel (Databases > phpMyAdmin) and it logs you in automatically, whatever your database user passwords are.
Can I find out the current password instead of changing it?
cPanel can't show existing database passwords. The one your site uses is in its config file (for WordPress, the DB_PASSWORD line in wp-config.php).
Related guides
- How to Create a MySQL Database and User in cPanel
- How to Fix "Error Establishing a Database Connection" in WordPress
- How to Edit a File in cPanel File Manager
- How to Reset Your WordPress Admin Password
Still stuck? Open a support ticket and the Instant Access Internet Services team will help.
