How to Set a MySQL Root Password in phpMyAdmin
Change phpMyAdmin Password in XAMPP
In this blog, I am going to show you how to secure your phpMyAdmin in XAMPP by setting a root password for MySQL. This step-by-step guide will walk you through updating the MySQL password and configuring phpMyAdmin to ensure secure database access.
To set a password for phpMyAdmin in XAMPP, follow these steps:
1. Set the MySQL Root Password
By default, XAMPP’s MySQL root user has no password. To set one:
- Open XAMPP Control Panel and start Apache and MySQL.
- Click the Admin button next to MySQL to open phpMyAdmin.
- Click on User accounts (top menu).
- Locate the root user for localhost and click Edit privileges.
- Go to the Change password tab, enter a new password, and confirm it.
- Click Go to save the changes.
2. Update the phpMyAdmin Configuration
Since phpMyAdmin uses the root user, you need to update its configuration to reflect the new password.
- Go to the C:\xampp\phpMyAdmin folder.
- Open the config.inc.php file in a text editor.
- Find the line:
- Replace it with:
- Save the file and restart Apache and MySQL from XAMPP Control Panel.
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['password'] = 'your_new_password';
3. Test phpMyAdmin
- Open phpMyAdmin (http://localhost/phpmyadmin).
- If it asks for login credentials, enter:
- Username: root
- Password: The password you just set.