安裝最新版本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
修改授權(quán)用戶
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'
password為mysql登陸密碼
推薦教程:PHPMyAdmin