How to Change a MySQL Password in cPanel (Beginner, No Command Line)
If you are on shared hosting and just need to change a MySQL password, you do not have to touch a single line of SQL or open a terminal. Your hosting control panel already has the buttons for it. In most cases you can do the whole thing — find the database user, generate a strong new password, and save it — in under two minutes using cPanel or phpMyAdmin.
This guide is the point-and-click, beginner-friendly version. We will walk through both graphical tools, then cover the one step almost everyone forgets: updating your website’s configuration so it can still connect after the password changes. If you would rather work from the command line, or you are resetting a forgotten root password, we link to the technical companion guides along the way.
Key Takeaways
• You can change a MySQL password entirely through cPanel → MySQL Databases or phpMyAdmin → User accounts, with no SQL required.
• Use the built-in Password Generator to create a strong password, and copy it somewhere safe before you click save.
• Critical: changing the database password does *not* update your website. You must also change the password in your site’s config (for WordPress, that is `DB_PASSWORD` in `wp-config.php`), or the site will show a database connection error.
• The command line is only needed for advanced cases — forgotten root passwords, automation, or servers without a control panel.
Why would you need to change a MySQL password?
A MySQL password is the credential a database user account uses to log in to your database. Your website — WordPress, Joomla, a custom PHP app, almost anything dynamic — uses this account quietly in the background every time someone loads a page.
You might want to change it because:
- You suspect the credentials were exposed or leaked (for example, after a malware cleanup or a shared password).
- You are rotating passwords as routine security hygiene.
- A developer or agency had access and no longer needs it.
- You simply forgot the password and want to set a fresh one you control.
The good news: on shared hosting you almost never need to know the *old* password to set a new one. The control panel owns the account, so it can overwrite the password directly.
How do you change a MySQL password in cPanel?
cPanel is the most common control panel on shared hosting, and its MySQL Databases tool is the simplest place to do this. Here is the full walkthrough.
| Step | What you do | Where to find it |
|---|---|---|
| 1 | Log in to cPanel | Usually `yourdomain.com/cpanel` or a link in your hosting account |
| 2 | Open MySQL Databases | Under the Databases section |
| 3 | Scroll to Current Users | Lists every database user on your account |
| 4 | Click Change Password (or the wrench/key icon) next to the user | In the Current Users row |
| 5 | Click Password Generator | A pop-up creates a strong random password |
| 6 | Copy the generated password and tick “I have copied this password” | In the generator pop-up |
| 7 | Click Use Password, then Change Password to save | Confirms the change |
A few details worth knowing:
- Database users vs. databases. In cPanel, a *user* and a *database* are separate things; one user can be attached to several databases. You change the password on the user, not the database. The user is the part that looks like `accountname_dbuser`.
- The Password Generator. cPanel ships with a one-click generator. Let it create a long, random string — it is far stronger than anything you would invent, and you only have to paste it once.
- No old password needed. Because cPanel manages the account, it simply sets the new password. You will not be asked for the current one.
Once you click save, the database user’s password is changed immediately. But your website does not know yet — hold that thought; it is the most important part of this guide and we cover it below.
How do you change a MySQL password in phpMyAdmin?
phpMyAdmin is the graphical database manager bundled with most cPanel hosting (you will find it in the Databases section too). It is a good alternative if your panel hides the MySQL Databases tool, or if you prefer working closer to the database itself — still with buttons, not SQL.
- Open phpMyAdmin from your control panel.
- Click the User accounts tab along the top.
- Find the user account you want in the list, then click Edit privileges on its row.
- At the top of that page, click the Change password tab.
- Type a new password into both boxes — or click Generate to have phpMyAdmin build a strong one and reveal it.
- Click Go to save.
phpMyAdmin will run the underlying SQL for you behind the scenes, so you get the result of a command-line change without writing the command.
Note on shared hosting limits: On many shared accounts, phpMyAdmin opens already scoped to *your* databases and you may not see a full User accounts tab. If that is the case, use the cPanel → MySQL Databases method above instead — it is the supported path for shared environments and will always work for your own users.
The step everyone forgets: update your site’s config
Here is the part that turns a quick task into an emergency call to support. Changing the password in cPanel or phpMyAdmin changes the database — it does not change your website. Your site stores a *copy* of the old password in its own configuration file and keeps trying to log in with it. The moment the database password no longer matches that stored copy, your site can no longer connect.
For WordPress, the visible result is the dreaded white page that reads “Error establishing a database connection.” The fix is simply to update the stored password to match the new one.
To update WordPress after changing the DB password:
- In cPanel, open File Manager (under Files).
- Navigate to your site’s root folder — usually `public_html` (or a subfolder if the site lives in one).
- Find the file named `wp-config.php`, right-click it, and choose Edit.
- Look for this line:
“`php define( ‘DB_PASSWORD’, ‘your-old-password’ ); “`
- Replace `your-old-password` with the new password you just generated — keep the quotes exactly as they are.
- Click Save Changes.
Reload your site and the database connection error should be gone. The same principle applies to any application: there is always a settings file or environment variable holding the database password. Update it everywhere the site connects.
Common places the password is stored, by platform:
| Platform | Where the database password lives |
|---|---|
| WordPress | `wp-config.php` → `DB_PASSWORD` |
| Joomla | `configuration.php` → `$password` |
| Drupal | `sites/default/settings.php` → database array |
| Laravel / generic PHP | `.env` → `DB_PASSWORD` |
| Custom app | Your app’s config or connection settings |
If you run more than one site or service against the same database user, remember to update all of them. Missing one means that single site breaks while the others keep working — which can be confusing to diagnose later.
How do you pick a strong password — and store it safely?
A database password is only ever typed by software, so there is no reason to make it short or memorable. Let the Password Generator in cPanel or phpMyAdmin do the work:
- Aim for a long, random string mixing letters, numbers, and symbols.
- Copy it before you save — the generator usually shows it only once.
- Store it in a password manager, not a sticky note or an email to yourself.
- Avoid the `$`, backtick, and quote characters if your app’s config gives you trouble; some config files treat them specially. If the generated password causes errors in `wp-config.php`, regenerate one without those symbols.
Because you are about to paste the same password into both the database and your site config, having it on your clipboard is exactly what you need for the very next step.
DarazHost shared and WordPress hosting plans come with cPanel and phpMyAdmin built in, so you can change a database password with a few clicks — no command line, no SSH, no guesswork. The same control panel includes File Manager, which makes updating `wp-config.php` (or any app config) just as quick once the password is changed. Our plans are designed to be beginner-friendly, and our support team is available 24/7 to walk you through database tasks if you would rather not do it alone. If you have ever stared at a “database connection” error and felt stuck, this is exactly the kind of thing we handle every day.
When should you use the command line instead?
The GUI methods above cover the vast majority of shared-hosting needs. You would step up to the command line (SSH and SQL) only in these situations:
- You are on a VPS or dedicated server with no control panel installed.
- You need to reset a forgotten root password and cannot log in at all — that requires a special recovery mode, not a simple change.
- You want to change the root user’s password specifically.
- You are scripting or automating password rotation across many servers.
For reference, the one-line SQL equivalent of everything we did with buttons is:
“`sql ALTER USER ‘dbuser’@’localhost’ IDENTIFIED BY ‘new-strong-password’; “`
If you want the full breakdown of that command and every other method — `SET PASSWORD`, `mysqladmin`, version differences between MySQL and MariaDB — see our complete reference on changing a MySQL or MariaDB user password. For the application-user angle and config follow-up in depth, see our guide to changing a MySQL user password the right way.
Frequently asked questions
Will changing my MySQL password take my website offline? Only briefly, and only if you skip the second half. The moment you change the password in cPanel, your site’s stored (old) password stops matching, so the site shows a database connection error until you update its config (for WordPress, `DB_PASSWORD` in `wp-config.php`). Update the config promptly and downtime is measured in seconds.
Do I need to know the current MySQL password to change it in cPanel? No. cPanel and phpMyAdmin manage the user account directly, so they can set a new password without asking for the old one. This is also why these tools are the easiest way to recover when you have lost a database user’s password.
I changed the password but now I see “Error establishing a database connection.” What happened? Your database password and your site’s stored password no longer match. Open `wp-config.php` (or your app’s config) in cPanel’s File Manager and replace the old `DB_PASSWORD` value with the new one, keeping the quotes intact. Save and reload — the error should clear.
Can I change the password in phpMyAdmin on shared hosting? Sometimes. Many shared accounts restrict phpMyAdmin’s User accounts tab. If you do not see it, use cPanel → MySQL Databases → Current Users → Change Password instead, which always works for your own database users.
Is a generated password really better than one I choose myself? Yes. Because software types the password, not you, length and randomness matter far more than memorability. A generated 16+ character random string is much harder to guess or brute-force, and you only need to copy it once into your password manager.