MySQL's "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 (for example, the native MySQL password is 110), use the "mysqladmin" command in the console. For example:
D:www.111cn.netxamppmysqlbinmysqladmin.exe-u Root Password 110
Note that after you change the password for root, do not forget to change the information in the phpMyAdmin. Search for "config.inc.php" under ... xamppphpmyadmin and edit the following lines:
The code is as follows |
Copy Code |
$cfg [' Servers '] [$i] [' user '] = ' root '; MySQL Superuser $cfg [' Servers '] [$i] [' auth_type '] = ' http '; HTTP://www.111cn.net MySQL authentification |
From now on, you need to correctly enter the "root" password to start phpMyAdmin.
add other ways to modify the root password
Method 1:
Under the/usr/www.111cn.net/mysql/bin/:
The code is as follows |
Copy Code |
./mysqladmin-u root password ' new_password '
|
This method is set for general installation.
Method 2:
In MySQL state:
The code is as follows |
Copy Code |
Mysql>update user SET Password=password (' New_password ') WHERE user= ' root '; Mysql>flush privileges; |
Method 3:
code is as follows |
copy code |
mysql>set PASSWORD for Root=password (' New_password '); |