help icon indicating copy to clipboard operation
help copied to clipboard

ER_NOT_SUPPORTED_AUTH_MODE problem in mysql (nodejs)

Open PpyMohan opened this issue 8 years ago • 14 comments

Node.js Version : v8.12.0 OS : windows 10 express: "^4.16.4", mysql: "^2.15.0"


my code is :


const mysql = require('mysql');

var mysqlconnection = mysql.createConnection({ host:'localhost', user: 'root', password:'password', database:'userdata' });

mysqlconnection.connect((err)=>{ if(!err) console.log('database connected..') else console.log('db not connected \n Error : '+JSON.stringify(err,undefined,2)); }); ............................................................................................................................................................

Error:

.............................................................................................................................................................. While running : node file.js i am getting error like this but user name ,db name and password are correct can any one help me out...?????? Error : { "code": "ER_NOT_SUPPORTED_AUTH_MODE", "errno": 1251, "sqlMessage": "Client does not support authentication protocol requested by server; consider upgrading MySQL client", "sqlState": "08004", "fatal": true }

PpyMohan avatar Oct 15 '18 10:10 PpyMohan

not sure what the cause is, but looks like changing root user resolves the issue. Please review https://github.com/mysqljs/mysql/issues/1507 for more context

gireeshpunathil avatar Oct 18 '18 09:10 gireeshpunathil

I don't see any issues with node.js here

gireeshpunathil avatar Oct 18 '18 09:10 gireeshpunathil

\o/ \o/ \o/ \o/ \o/ ALTER USER 'root'@'localhost' IDENTIFIED BY ''; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '';

ProjetosApps avatar Feb 01 '19 00:02 ProjetosApps

ping @PpyMohan

gireeshpunathil avatar Jun 12 '19 07:06 gireeshpunathil

Hey I tried the fix ProjetosApps suggested on linux but it did nothing except giving me an error in my sql syntax.

Error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourRootPasswo' at line 1

oceansync avatar Jun 15 '19 21:06 oceansync

@Deniernal354 i think you forgot to put ALTER in front of your query. This is how it should look like: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YourRootPasswo';

kimeggler avatar Jun 18 '19 09:06 kimeggler

ping @PpyMohan again - is this outstanding?

gireeshpunathil avatar Jun 26 '19 04:06 gireeshpunathil

inactive, closing

gireeshpunathil avatar Jul 15 '19 07:07 gireeshpunathil

Best Solution try this it will resolve:

You got this Error : ER_NOT_SUPPORTED_AUTH_MODE this is error is mentioning when you install sql server you selected"strong authentication", but you set a weak password. You need to reset strong password or need to choose legacy authentication method.

Follow these steps to choose legacy authentication method

You installed mysql server using "mysql installer"

1)open -> "mysql intsaller"

2)press reconfig mysql server

3)select left side "authentication method tab"

4)select radio button -->use legacy authentication method

5)now stop and restart the db

Tamilselvanret avatar Sep 10 '19 05:09 Tamilselvanret

Best Solution try this it will resolve:

You got this Error : ER_NOT_SUPPORTED_AUTH_MODE this is error is mentioning when you install sql server you selected"strong authentication", but you set a weak password. You need to reset strong password or need to choose legacy authentication method.

Follow these steps to choose legacy authentication method

You installed mysql server using "mysql installer"

1)open -> "mysql intsaller"

2)press reconfig mysql server

3)select left side "authentication method tab"

4)select radio button -->use legacy authentication method

5)now stop and restart the db

Thanks a lot, it worked for my using MySQL 8.0.18 with NodeJS

jfsilvah avatar Nov 20 '19 00:11 jfsilvah

Best Solution try this it will resolve:

You got this Error : ER_NOT_SUPPORTED_AUTH_MODE this is error is mentioning when you install sql server you selected"strong authentication", but you set a weak password. You need to reset strong password or need to choose legacy authentication method.

Follow these steps to choose legacy authentication method

You installed mysql server using "mysql installer"

1)open -> "mysql intsaller"

2)press reconfig mysql server

3)select left side "authentication method tab"

4)select radio button -->use legacy authentication method

5)now stop and restart the db

THANK YOU VERY MUCH IT IS WORKING NOW

ankushk5 avatar Mar 27 '20 17:03 ankushk5

"code": "ER_ACCESS_DENIED_ERROR", "errno": 1045, "sqlMessage": "Access denied for user 'root'@'localhost' (using password: NO)", "sqlState": "28000", "fatal": true

haribabu499 avatar May 04 '20 20:05 haribabu499

Best Solution try this it will resolve:

You got this Error : ER_NOT_SUPPORTED_AUTH_MODE this is error is mentioning when you install sql server you selected"strong authentication", but you set a weak password. You need to reset strong password or need to choose legacy authentication method.

Follow these steps to choose legacy authentication method

You installed mysql server using "mysql installer"

1)open -> "mysql intsaller"

2)press reconfig mysql server

3)select left side "authentication method tab"

4)select radio button -->use legacy authentication method

5)now stop and restart the db

thank you mann,,,its worked,,you r awsome

Archa-legacy avatar Nov 17 '23 08:11 Archa-legacy

thanks a lot of

MDFAYSALHOSSAIN019 avatar Dec 04 '23 15:12 MDFAYSALHOSSAIN019