• Register
0 votes
120 views

Problem :

I am very new to node.js and MySQL and I have just started setting up and also trying out some basic code. But, I am unable to make even the simple connection to a server for some reason. I have also installed a newest MySQL Community 8.0 database along with the Node.JS with the default settings.

Below is my node.js code

    Var sql = require('sql');

    var mycon = sql.createConnection({
      host: "localhost",
      user: "root",
      password: "password",
      insecureAuth : true
    });

   mycon.connect(function(err) {
      if (err) throw err;
      console.log("Connected!");
    });

 

My Error:

Client does not support authentication protocol requested by server consider upgrading mysql client”

 

7 5 2
3,870 points

1 Answer

0 votes

Solution :

You need to execute the below query in MYSQL Workbench

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

Where the root is your user localhost is your URL and password is your password

Then run below query to refresh the privileges:

flush privileges;

After that you can try connecting using the node after you do so.

If that does not work then try it without @'localhost' part.

OR

In your Mysql Latest docker container try to run below query

ALTER USER root IDENTIFIED WITH mysql_native_password BY 'password';

 Hope the above listed solutions will fix your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 29 views
0 votes
1 answer 1K views
1K views
Problem : I am new to NodeJS and trying to connect to mySQL through the NodeJS file, however I am facing the below error : { Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES) at Handshake.Sequence._packetToError (/home/alecxe/Node ... bar" AS second_field', function(err, results, fields) { console.log(err); console.log(results); myconnection.end(); } );
asked Dec 6, 2019 alecxe 7.5k points
0 votes
1 answer 1.2K views
1.2K views
Problem : I had recently uninstalled the Postgres10 and after that reinstalled the Postgres10. After that I went to run a Node, Express, React application that relies on connecting to a Postgres10 database and also communicates with it using Sequelize. Initially I was unable to ... app at in the browser. Does anyone have any idea what is going wrong? Please suggest me the solution for my error.
asked Nov 22, 2019 peterlaw 6.9k points
1 vote
2 answers 435 views
435 views
Problem : I am very new to the Node.js and I am having few issues. I am using the Node.js 4.10 and Express 2.4.3. While trying to execute my code I am receiving below error : Error: Can't render headers after they are sent to the client. ... , scope: 'offline_access,email,user_about_me,user_activities,manage_pages,publish_stream', failedUri: '/noauth' }) ])); realapp.use(realapp.router); }); . . .
asked Dec 12, 2019 alecxe 7.5k points
0 votes
1 answer 11 views
11 views
Problem: I am very new to cordova, phonegap, ant,sdk,jdk. I am learning to use phonegap/cordova. Everything is installed properly on my machine i.e cordova, phonegap, ant,sdk,jdk. But now suddenly it started saying that: "’Node' is not recognized as an ... insufficient knowledge I am unable to fix this issue. I am looking for cordova and phonegap experts who can help me in fixing this issue.
asked Sep 2 Raphael Pacheco 4.9k points