How to Set a MySQL Root Password in phpMyAdmin

phpMyAdmin Password Setup in XAMPP

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:

  1. Open XAMPP Control Panel and start Apache and MySQL.
  2. Click the Admin button next to MySQL to open phpMyAdmin.
  3. Click on User accounts (top menu).
  4. Locate the root user for localhost and click Edit privileges.

    Change root user password in phpmyadmin

  5. Go to the Change password tab, enter a new password, and confirm it.
  6. 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.

  1. Go to the C:\xampp\phpMyAdmin folder.
  2. Open the config.inc.php file in a text editor.
  3. Find the line:
  4. $cfg['Servers'][$i]['password'] = '';
  5. Replace it with:
  6. $cfg['Servers'][$i]['password'] = 'your_new_password';
  7. Save the file and restart Apache and MySQL from XAMPP Control Panel.

3. Test phpMyAdmin

  1. Open phpMyAdmin (http://localhost/phpmyadmin).
  2. If it asks for login credentials, enter:
  • Username: root
  • Password: The password you just set.

Thank You!