How to Set or Reset the MySQL Root Password in WampServer
WampServer gives MySQL's root user no password at all. That is convenient on an isolated machine — phpMyAdmin opens instantly — but on a shared network, or when mirroring a live setup, it is a real weakness. Root can create, read, and delete every database, so it deserves a proper password.
Setting one is easy. What trips people up is the follow-through: phpMyAdmin and your local sites store the old blank credentials, so they break when the password changes — unless you update them too. This guide covers both halves. If you have not worked with databases here yet, first see create a database in phpMyAdmin with WampServer for the basics. And if you are connecting a site to that database, install WordPress on WampServer shows where these credentials are used in practice.
Should You Set a Root Password on Localhost?
| Situation | Recommendation |
|---|---|
| Solo PC, no shared network | Optional, but good practice |
| Shared home/office network | Yes — set a strong password |
| Mirroring a live server setup | Yes — match live habits locally |
| Testing an app's login/security flow | Yes — required for realistic tests |
Even when it is optional, learning this on localhost — where a mistake costs nothing — beats learning it under pressure on a live server.
How to Set the MySQL Root Password in phpMyAdmin
This is the clean method when you can still log in, which on a default install means root with a blank password.
Step 1: Open phpMyAdmin From the Tray Menu
Start WampServer, wait for the green icon, left-click it and choose phpMyAdmin. Log in as root with no password if prompted.
Step 2: Open the Root User Account
- Click the User accounts tab at the top of phpMyAdmin.
- Find the row for user root, host name localhost.
- Click Edit privileges on that row.
You may see several root rows with different hosts (127.0.0.1, ::1). The localhost row is the one phpMyAdmin and most local apps use; repeat this process for each root row you use.
Step 3: Set the New Password
- Click the Change password tab.
- Enter a strong password — at least 12 characters, mixing letters, numbers, and symbols.
- Re-enter it to confirm, leave the authentication plugin as default, and click Go.
phpMyAdmin will immediately log you out, because your session used the old blank password. That is expected — it proves the change worked.
Step 4: Update phpMyAdmin's Configuration
Here is the step most guides skip: phpMyAdmin may still hold the old settings.
- Open
C:\wamp64\apps\phpmyadmin\config.inc.phpin a text editor (the version number in theappsfolder name varies). - Find the line for the auth type. If it says
$cfg['Servers'][$i]['auth_type'] = 'config';, phpMyAdmin stores credentials in this file. Either update the stored password line to your new password —$cfg['Servers'][$i]['password'] = 'your-new-password';— or, more securely, changeauth_typeto'cookie'so phpMyAdmin asks you to log in each time. - Save the file.
The cookie option is the better habit: no password sits in a plain-text file. Either way, reload phpMyAdmin and confirm you can log in with the new password before going further.
Step 5: Update Your Local Sites and Apps
Any local site connecting as root now needs the new password. In WordPress, that is DB_PASSWORD in wp-config.php:
define( 'DB_PASSWORD', 'your-new-password' );
Update every local site that uses root and confirm each one loads. Better still, create a dedicated database user per site with access only to that site's database — root is for administration, not everyday app connections.
How to Reset a Forgotten Root Password
Locked out? Reset the password by starting MySQL in a mode that skips permission checks. Complete every step, including the restart at the end.
Step 1: Stop MySQL and Start It With Skip-Grant-Tables
- Left-click the tray icon and stop all services, or stop just MySQL under MySQL > Service administration.
- Open a Command Prompt as Administrator and navigate to the MySQL
binfolder, for exampleC:\wamp64\bin\mysql\mysqlx.x.x\bin(your version folder name will differ). - Start MySQL without the grant tables: Leave this window open — MySQL is running in it. The
--skip-networkingflag matters: in this mode anyone could connect, so networking stays off while you work.mysqld --skip-grant-tables --skip-networking
Step 2: Connect and Set a New Password
Open a second Command Prompt in the same bin folder and connect:
mysql -u root
Then run these commands, replacing the example with your own strong password:
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your-new-password';
FLUSH PRIVILEGES;
EXIT;
The first FLUSH PRIVILEGES is required — without it, the ALTER USER statement is refused in skip-grant mode.
Step 3: Restart MySQL Normally
Close the first Command Prompt window to stop the special instance. Restart all services from the tray icon, wait for green, and log in to phpMyAdmin with the new password to confirm access is restored. If it still fails, re-check config.inc.php as in Step 4 above.
Keeping the New Password Safe
Store the password in a password manager, not a desktop text file. It also appears in config.inc.php (with config auth) and each site's wp-config.php, so anyone with those files has it — another reason to prefer cookie auth and dedicated users per site. Never reuse your live server's root password on localhost.
The database engine behind all of this is MySQL, the open-source relational database that powers WordPress and most PHP applications you will run locally.
Frequently Asked Questions
What is the default MySQL root password in WampServer?
There is none — on a fresh WampServer 3.x install, root has a blank password. That is why phpMyAdmin often opens without asking for credentials, and why setting a password is one of the first hardening steps worth doing.
phpMyAdmin says "Access denied" after I changed the password. What happened?
phpMyAdmin is still presenting the old credentials. Open config.inc.php under C:\wamp64\apps\, update the stored password, or switch auth_type from config to cookie and log in manually. Clear browser cookies for localhost if the error persists.
Will changing the root password break my local WordPress sites?
Only until you update them. Change DB_PASSWORD in each site's wp-config.php to the new value and it works again immediately. Sites with a dedicated database user are unaffected — a good argument for setting those up.
I have root rows for localhost, 127.0.0.1, and ::1. Do I change all of them?
Yes — set the same strong password on all root rows. Connections via localhost, 127.0.0.1, and ::1 can match different rows, so leaving one blank leaves a real opening. Edit each root row in the User accounts tab and repeat the Change password step.
Conclusion
Setting the MySQL root password in WampServer takes two moves: change it in phpMyAdmin's User accounts, then update every place the old credentials are stored — config.inc.php and each site's wp-config.php. If you forget it, the skip-grant-tables reset recovers access, provided networking stays off during the reset and you restart normally afterwards. Store it in a password manager, and your local databases get the same basic protection as a live server.