Console9

How to reset the MariaDB password in XAMPP

Reset or change the MariaDB (MySQL) root password in XAMPP on Windows using the mysqladmin command-line tool through the XAMPP Shell.

Reset or change the MariaDB (MySQL) root password in XAMPP on Windows to secure the local database server or recover from a forgotten password.

Prerequisites

Step-by-Step: Reset the MariaDB Root Password in XAMPP

  1. Open the XAMPP Control Panel. Click the Shellbutton to launch the XAMPP command-line shell.

    XAMPP control panel with Shell button highlighted for MySQL password reset

  2. Run the mysqladmin command to set a new root password. Enter the following command in the XAMPP Shell:

    mysqladmin --user=root password

    The mysqladmin tool connects to the MariaDB server and prompts for a new password. This command works when the current root password is empty (the XAMPP default).

  3. Enter the new password when prompted. Type the new password and press Enter. MariaDB updates the root user password immediately.

Reset the Password When the Current Password Is Known

If the root user already has a password, include the current password with the -p flag:

mysqladmin --user=root -p password

The mysqladmin tool prompts for the current password first, then for the new password.

How to Verify the MariaDB Password Reset in XAMPP

Open the XAMPP Shell and connect to MariaDB with the new password:

mysql --user=root --password={YOUR_NEW_PASSWORD}

MariaDB displays the MariaDB [(none)]> prompt if the password is correct.

Common Issues When Resetting the MariaDB Password in XAMPP

"ERROR 1045 (28000): Access denied for user 'root'@'localhost'."The current root password is not empty. Use the -p flag with mysqladmin to supply the existing password before setting a new one.

phpMyAdmin stops working after the password change.phpMyAdmin uses the root credentials stored in its configuration file. Open C:\xampp\phpMyAdmin\config.inc.php and update the password value in the $cfg['Servers'][$i]['password'] line to match the new MariaDB root password. Restart Apache HTTP Server from the XAMPP Control Panel.