6
respostas

code: 'ER_NOT_SUPPORTED_AUTH_MODE'

Meu VS Code ta dando o seguinte erro, sendo que estou usando a versão mais nova do mysql.

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\sequences\Sequence.js:47:14)
    at Handshake.ErrorPacket (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18)
    at Protocol._parsePacket (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\Protocol.js:291:23)  
    at Parser._parsePacket (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\Parser.js:433:10)      
    at Parser.write (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\Parser.js:43:10)
    at Protocol.write (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\Protocol.js:38:16)
    at Socket.<anonymous> (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\Connection.js:88:28)
    at Socket.<anonymous> (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\Connection.js:526:10)
    at Socket.emit (events.js:311:20)
    at addChunk (_stream_readable.js:294:12)
    --------------------
    at Protocol._enqueue (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\Protocol.js:144:48)      
    at Protocol.handshake (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\protocol\Protocol.js:51:23)      
    at Connection.connect (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\node_modules\mysql\lib\Connection.js:116:18)
    at Object.<anonymous> (C:\Users\Digoo\OneDrive\Documentos\VS_Code\Alura\RestComNodeJS\index.js:4:9)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  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
}
6 respostas

Também estou recebendo esse erro. Alguém pode ajudar?

[nodemon] starting node index.js Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client at Handshake.Sequence.packetToError (C:\Users\isa13\alura\nodemodules\mysql\lib\protocol\sequences\Sequence.js:47:14) at Handshake.ErrorPacket (C:\Users\isa13\alura\node_modules\mysql\lib\protocol\sequences\Handshake.js:123:18) at Protocol.parsePacket (C:\Users\isa13\alura\nodemodules\mysql\lib\protocol\Protocol.js:291:23) at Parser.parsePacket (C:\Users\isa13\alura\nodemodules\mysql\lib\protocol\Parser.js:433:10) at Parser.write (C:\Users\isa13\alura\node_modules\mysql\lib\protocol\Parser.js:43:10) at Protocol.write (C:\Users\isa13\alura\node_modules\mysql\lib\protocol\Protocol.js:38:16) at Socket. (C:\Users\isa13\alura\node_modules\mysql\lib\Connection.js:88:28) at Socket. (C:\Users\isa13\alura\node_modules\mysql\lib\Connection.js:526:10) at Socket.emit (events.js:315:20)

at addChunk (internal/streams/readable.js:309:12)
--------------------
at Protocol._enqueue (C:\Users\isa13\alura\node_modules\mysql\lib\protocol\Protocol.js:144:48)
at Protocol.handshake (C:\Users\isa13\alura\node_modules\mysql\lib\protocol\Protocol.js:51:23)
at Connection.connect (C:\Users\isa13\alura\node_modules\mysql\lib\Connection.js:116:18)
at Object.<anonymous> (C:\Users\isa13\alura\index.js:4:9)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {

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 } [nodemon] clean exit - waiting for changes before restart

Mesmo erro aqui, help

Aqui também!

Estou com o mesmo erro...

Executei a seguinte query no mysql e resolveu o problema de conexão:

usuario = colocar o nome do usuário do banco senha= colocar a senha do usuário informado

ALTER USER 'usuario'@'localhost' IDENTIFIED WITH mysql_native_password BY 'senha';

Estou com o mesmo problema porque estou usando o docker do mysql e ele tem um problema com o AllowPublicKeyRetrieval que precisa ser True(para quem usa dBeaver aí por exemplo)....

Consegui resolver da seguinte forma :

no terminal, instale o módulo mysql2 utilizando o npm install mysql2

Toquei o require da seguinte forma :

const mysql = require('mysql') por const mysql = require('mysql2')

Esperto ter ajudado...

Abs,

Marco A. Smanioto