Spring Fresh Sale! - Up To 67% OFF BDIX Hosting + Free Domain
Database

How to Reset a MySQL Database User’s Password in cPanel

If your site suddenly shows a database connection error, a changed or forgotten MySQL user password is a common reason. The fix has two halves: reset the password in cPanel, then update your site's config file to match. Miss the second half and the site stays broken, so we will do both.

Step 1: Reset the password in cPanel

  1. Log in to cPanel.
  2. Open MySQL Databases under the Databases section.
  3. Scroll to Current Users, find the user, and click Change Password (or set a new one via the password fields).
  4. Enter a strong new password and save. Use the password generator for a solid one — see creating strong passwords.

Step 2: Update your site's config

Your website stores this password in its configuration file so it can connect. Update it to the new one:

  • WordPress — edit DB_PASSWORD in wp-config.php.
  • Other apps — edit the database password in their config file (often config.php or .env).

Use File Manager to edit the file, then reload your site.

Step 3: Confirm the connection

Load your website. If it comes back, the password now matches. If you still see a database connection error, double-check the database name, username and host as well.

Frequently asked questions

Do I need to know the old password to reset it?

No. From cPanel you can set a new password for the user without the old one, since you control the account. Just remember to update your site's config to match.

My site broke right after I changed the password.

That is expected — the site is still using the old password until you update its config file. Edit wp-config.php (or your app's config) with the new password and it reconnects.

Is the database user the same as my cPanel login?

No. The MySQL user is a separate account used only by your website to reach its database. Changing it does not affect your cPanel password, and vice versa.

Was this article helpful?