How to change a MySQL user password in cPanel

Category: cPanel

Changing a MySQL user password in cPanel is useful when you rotate access after sharing credentials, when a password may have been exposed, or when you need to recover a database connection. Do it carefully: if your site uses that user, you must also update the password in the application’s configuration file.

Before saving the change, identify the exact database and user used by the site. On shared hosting, full names often include your account prefix, for example account_user.

Before you start

  • Have access to cPanel for the account where the site lives.
  • Locate the application configuration file, such as wp-config.php, configuration.php, .env, or the file your CMS reads.
  • Save a copy of the configuration file before editing it.
  • Schedule the change during low traffic if the site depends on that database.

Identify the correct user

  1. Open the site’s configuration file from File Manager, FTP, or the method you normally use.
  2. Find the database username value; in many CMS apps, it is usually in a variable like DB_USER.
  3. Copy the full MySQL username, including the account prefix.
  4. Also confirm the database name so you do not change a user that belongs to another application.

Change the password in cPanel

  1. Log in to cPanel and open the Databases section.
  2. Click MySQL Databases.
  3. Scroll down to Current Users.
  4. Find the MySQL user you identified in the configuration file.
  5. Click Change Password.
  6. Generate or type a strong password and save it in a secure password manager.
  7. Confirm the change and wait for the success message before leaving cPanel.

Update the application

  1. Return to the site’s configuration file.
  2. Replace only the old password with the new one, without changing the database name or username.
  3. Save the file and avoid adding spaces before or after the password.
  4. If you use application cache or a cache plugin, clear it after the change.
  5. Keep the original file copy until you confirm that the site responds correctly.

Verify the connection

  • The site opens in a private window without a database connection error.
  • The CMS dashboard loads and lets you browse pages, posts, products, or courses.
  • In phpMyAdmin, the database opens without permission errors for that user.
  • The error log does not show new MySQL authentication messages after the change.

Common errors

  • The site shows a database connection error: the application still has the old password; update the configuration file and check for extra spaces.
  • You changed the wrong user: another application stopped connecting or the original site did not change; check DB_USER or the equivalent file and repeat the change on the correct user.
  • phpMyAdmin opens, but the CMS fails: the file password is correct, but that MySQL account does not have privileges on that database; review the assignment in MySQL Databases.

When to ask for help

Ask for help if you cannot find the configuration file, if the site uses an external connection, if the change affects a live store, or if the error continues after confirming credentials, database, and password. Share the domain, database name, MySQL user, and the exact message that appears.

Still need help?

If this guide didn’t solve your issue, our team can help you via ticket.