Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

javascript - ER_NOT_SUPPORTED_AUTH_MODE - MySQL server


Failed to Connect to MySQL DB via MySQL JavaScript Module

? ? ? ? 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.



When the Connection Failed, the Following Error was Logged:

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

? ? ? ? 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'
    }); 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For now 8.0 version is way to change plugin : Use this example:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...