How to Change a MySQL Database User's Password

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:

  1. In cPanel, go to Files > File Manager and open public_html (or the folder WordPress is in).
  2. Right-click wp-config.php and choose View.
  3. Note the values of DB_NAME and DB_USER, for example username_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

  1. In cPanel, go to Databases > Manage My Databases.
  2. Scroll down to the Current Users table.
  3. Find the user from Step 1 and click Change Password next to it.
  4. Type a new password in both boxes, or click Password Generator to create a strong one. Copy the password somewhere safe before you continue.
  5. 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

  1. Go back to Files > File Manager, right-click wp-config.php and choose Edit.
  2. Find this line:
    define( 'DB_PASSWORD', 'old-password-here' );
  3. Replace only the text between the quote marks with your new password. Leave the quote marks, comma and semicolon exactly as they are.
  4. Click Save Changes.
  5. 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

Still stuck? Open a support ticket and the Instant Access Internet Services team will help.

Ultrafast LiteSpeed hosting from InstantAccess.net: free SSL, free backups, cPanel included, no contracts. Check out our $10/month hosting.
  • change mysql user password cpanel, reset database password cpanel, mysql password wordpress, update wp-config database password, cpanel manage my databases, database user password
  • 0 משתמשים שמצאו מאמר זה מועיל
?האם התשובה שקיבלתם הייתה מועילה

מאמרים קשורים

How to Create a MySQL Database and User in cPanel

Most website software, including WordPress, Joomla and online shops, stores its content in a...

How to Import and Export a Database with phpMyAdmin

phpMyAdmin lets you save a copy of a database to your computer or load a database from a file,...

How to Open phpMyAdmin from cPanel and Find Your Way Around

phpMyAdmin is a web page for looking inside your MySQL databases: you can see the tables your...

How to Move a MySQL Database from Another Host to Your Account

Moving a website to us usually means moving two things: the files and the MySQL database behind...

How to Import a Database That's Too Big for phpMyAdmin (Using SSH)

phpMyAdmin on your hosting account accepts import files up to 50 MB, and even smaller files can...