ER_NOT_SUPPORTED_AUTH_MODE - MySQL 服务器 [英] ER_NOT_SUPPORTED_AUTH_MODE - MySQL server

查看:27
本文介绍了ER_NOT_SUPPORTED_AUTH_MODE - MySQL 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我向我的 Node.js" 服务器添加了一个 MySQL" 数据库.在完成 MySQL" 设置过程后——确保数据库正常工作——我尝试通过 JavaScript 实际代码片段(下面的示例)连接到服务器,但令我沮丧的是,连接尝试失败.

        I added a "MySQL" database to my "Node.js" server. After going through the "MySQL" setup process — to ensure the DB was working — I attempted to connect to the server via the JavaScript de facto code snippet (example below), and to my dismay, the connection attempt failed.

"ER_NOT_SUPPORTED_AUTH_MODE:客户端不支持认证服务器请求的协议;考虑升级 MariaDB 客户端"

"ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MariaDB client"

错误让我感到困惑,因为我已经卸载了 MariaDB",并在其位置安装了 MySQL".我想知道是什么导致了错误,我该如何修复它才能连接到数据库?

        The error was perplexing to me, as I already uninstalled "MariaDB", and installed "MySQL" in its place. What I would like to know is what is causing the error, and how can I fix it so I am able to connect to the Database?


    // This is my attempt of connection

    var mysql = require('mysql');
    
    var connection = mysql.createConnection({
        host     : 'localhost',
        user     : 'root',
        password : '********',
        database : 'foobarDb'
    }); 

推荐答案

我觉得有些 MySQL 版本的连接建立认证有点乱.我所要做的就是添加行 "insecureAuth":对 CreateConnection(...) 凭据的真实.

I figure that some MySQL versions have the authentication for the establishment of a connection a bit messed up. All I had to do was add the line "insecureAuth" : true to the CreateConnection(...) credentials.

var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'root',
  password : '********',
  database : 'vod_bill_database',
  insecureAuth : true
}); 

现在错误消失,客户端连接成功.

The error is gone now, and the client is successfully connecting.

这篇关于ER_NOT_SUPPORTED_AUTH_MODE - MySQL 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆