How I can set a "root" password in MySQL? (method 1)
In the \xampp\mysql\bin directory enter into the console:mysqladmin -u root password secret
Ok, "secret" should be your secret password. Then update the password for PHPMyAdmin. Open the "config.inc.php" in \xampp\phpmyadmin an edit following lines:
INSTEAD OF ...
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = '';NOW ...
$cfg['Servers'][$i]['user'] = 'root'; $cfg['Servers'][$i]['password'] = 'secret';
Set a new 'root' passwort with mysqladmin
How I can set a "root" password in MySQL? (method 2 )
Well, there is still another possibility to set the root password. Start PHPMyAdmin with http://127.0.0.1/phpmyadmin, open the database "mysql" (never delete this!) and use the table "user". Create here a new user or e.g. simply change the password of "root." MySQL restart! After that, do not forget to change the password in the "xampp/phpmyadmin/config.inc.php" for PHPMyAdmin.How I can set a "root" password in MySQL? (method 3 )
This method based on a suggestion by Ruedi from Basel. With that: Thanks and Grüssli to Switzerland!Tip: Resetting the password can be make also with the /xampp/mysql/resetroot.bat. After that, the password is empty means "".
Step 1: Run cmd
C:\ program files \apachefriends\xampp\mysql\bin>mysqld-nt --skip-grant-tables
Step 2: Run cmd
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root flush-privileges password "newpwd"
Step 3: Stopping MySQL
C:\>C:\ program files\apachefriends\xampp\mysql\bin\mysqladmin -u root -p shutdown
Enter password: ****** (newpwd)
Step 4: Edit the “config.inc.php” for the access of PHPMyAdmin
C:\ program files\apachefriends\xampp\phpmyadmin\config.inc.php
Here search for "root"
'$cfg['Servers'][$i]['password'] = 'newpwd'; // MySQL password
Step 5: MySQL restart
转载:http://www.apachefriends.org/zh_cn/faq-xampp-windows.html#password0