mysqli :: __ construct():服务器请求客户端未知的身份验证方法

时间:2019-07-15 01:19:30

标签: php mysql database mysqli

我正在尝试遵循youtube上有关如何通过数据库编辑和插入图片的教程,并且按照youtube视频进行操作,但仍然遇到此问题

这是我看到的错误:

Warning: mysqli::__construct(): The server requested authentication method unknown to the client [caching_sha2_password] in C:\xampp\htdocs\exercise1\dbConfig.php on line 9

Warning: mysqli::__construct(): (HY000/2054): The server requested authentication method unknown to the client in C:\xampp\htdocs\exercise1\dbConfig.php on line 9Unable to connect database: The server requested authentication method unknown to the client

这是我的代码形式dbconfig:

//DB details
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = '';
$dbName = 'users';

//Create connection and select DB
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);

if($db->connect_error){
    die("Unable to connect database: " . $db->connect_error);
}



0 个答案:

没有答案