The old XAMPP security functions to set the mysql root password are no longer maintained by the XAMPP developers. This code was old and buggy and has screwed up several dozen xampp installations.
This thread explains in detail how to set the root password with help of the very well maintained MySQL CLI and phpMyAdmin.
How to set a MySQL root password successfully
0. Requirements
To change any password you need to start MySQL first.
If you want to change the password with phpMyAdmin Apache needs to be started too.
1a. Setting root password with MySQL CLI
- Open the XAMPP control panel and click the Shell button to start the XAMPP shell.
(You may get asked if XAMPP should create the shell file because it is not existent. Accect this) - login to MySQL DBMS with the following command
- Code: Select all
mysql --user=root --password=
(the string after password= is empty because by default user root@localhost does not have any password) - Set the new password with the following command
- Code: Select all
SET PASSWORD = PASSWORD('put your new password here');
- If you have done everything correct you will get this output
- Code: Select all
Query OK, 0 rows affected (0.00 sec)
1b. Setting root password with phpMyAdmin
- Open your browser and request http://localhost/phpmyadmin/
(You will get logged in automatically) - click on the Users tab
- click on the Edit Privileges link of the user root with host localhost
- click on the Change password link
- Activate the choice Password, type in and re-type the new password and click on Go
- If the password could be set successful you will see a message like this
- Code: Select all
The password for 'root'@'localhost' was changed successfully.
2. Let phpMyAdmin know the changes
- Open (in plain text editor of your choice) the file \xampp\phpMyAdmin\config.inc.php
- search for the line
- Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'config';
- Change this line to
- Code: Select all
$cfg['Servers'][$i]['auth_type'] = 'cookie';
- save the file
Login with phpMyAdmin
If you now access phpmyadmin you will get a login form where you can use the new credentials