The "root" user of MySQL has no password by default. Therefore, you can use mysql_connect ("localhost", "root", "") in PHP to connect to the MySQL server;
If you want to set a password for the "root" user in MySQL, use the "mysqladmin" command in the console. For example:
\... \ XAMPP \ mysql \ bin \ mysqladmin-u Root Password secret
E: \ xampplite \ mysql \ bin> mysqladmin-u Root Password "test2009"
Note that after you change the root password, do not forget to change the related information in phpMyAdmin. Search for "config. Inc. php" under "\... \ XAMPP \ phpMyAdmin \" and edit the following lines:
$ Cfg ['servers'] [$ I] ['user'] = 'root'; // mysql superuser
$ Cfg ['servers'] [$ I] ['auth _ type'] = 'http'; // HTTP MySQL Authentification
From now on, you must enter the "root" password to start phpMyAdmin.
References: http://www.apachefriends.org/zh_cn/xampp-windows.html