ThinkPHP5 连接MYSQL8.0.13出错

浏览:4737 发布日期:2018/12/18 分类:ThinkPHP5专区
使用5.6版本正常,将8版本的密码加密方式改成:mysql_native_password,localhost登陆.出现如下错误,

[2054] PDOException in Connection.php line 528
SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

try {
if (empty($config['dsn'])) {
$config['dsn'] = $this->parseDsn($config);
}

if ($config['debug']) {
$startTime = microtime(true);
}

$this->links[$linkNum] = new PDO($config['dsn'], $config['username'], $config['password'], $params);

if ($config['debug']) {
// 记录数据库连接信息
$this->log('[ DB ] CONNECT:[ UseTime:' . number_format(microtime(true) - $startTime, 6) . 's ] ' . $config['dsn']);
}

return $this->links[$linkNum];
} catch (\PDOException $e) {
if ($autoConnection) {

最佳答案
评论( 相关
后面还有条评论,点击查看>>