MySQL "root" user default state is no password, so in PHP you can use mysql_connect ("localhost", "root", "") to connect to the MySQL server, if you want to set a password for the "root" user in MySQL, Please use the "mysqladmin" command in the console. For example:
Under the Windows version of XAMPP: \...\xampp\mysql\bin\mysqladmin-u root-p password New password
After running, you will be prompted for the old password, and if it is correct, the newly entered password will be modified immediately.
The Linux version of XAMPP is the following command:
/opt/lampp/bin/mysqladmin-u root-p Password New password
Note that after you change the root password, do not forget to change the information in PHPMyAdmin. Under \...\xampp\phpmyadmin\, search for "config.inc.php" and edit the following lines:
$ cfg[' Servers ' [$i] [' user '] = ' root '; MySQL SuperUser $cfg [' Servers '] [$i] [' auth_type '] = ' http '; HTTP MySQL authentification