Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password:

时间:2022-09-19 21:12:40
Warning : mysqli_connect(): (HY000/1045):Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) inD:\xampp\php\includes\myfun2.phpon line 17
Error Access denied for user 'root'@'localhost' (using password: YES))
 in D:\xampp\php\includes\myfun2.php on line  17

Error Access denied for user 'root'@'localhost' (using password: YES)



#1045 - Access denied for user 'root'@'localhost' (using password: NO) 

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: phpMyAdmin 尝试连接到 MySQL 服务器,但服务器拒绝连接。您应该检查配置文件中的主机、用户名和密码,并确认这些信息与 MySQL 服务器管理员所给出的信息一致。

需要修改D:\xampp\phpMyAdmin\config.inc.php文件,具体内容如下:

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;


把下面这句改为:

$cfg['Servers'][$i]['auth_type'] = 'cookie';

就可了