安装最新版本MySQL导致登录phpMyAdmin报错
安装了最新版mysql以后用phpMyadmin登录,遇到报错
第一种报错:
mysqli::real_connect(): (HY000/2002): No such file or directory
解决办法:
把/libraries/config.default.php 和/config.sample.inc.php文件中的
$cfg['Servers'][$i]['host'] = 'localhost'
改为
$cfg['Servers'][$i]['host'] = '127.0.0.1';
第二种报错:
mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password] mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
解决办法:
终端登陆mysql
mysql -u root -p
修改授权用户
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
password为mysql登陆密码
推荐教程:PHPMyAdmin