Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Resultado da query , não é mostrado na tela.

Bom dia, não estou conseguindo visualizar a saída da query, segue o erro:

Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
    at Handshake.Sequence._packetToError (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
    at Handshake.ErrorPacket (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/sequences/Handshake.js:103:18)
    at Protocol._parsePacket (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/Connection.js:103:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:172:18)
    at Socket.Readable.push (_stream_readable.js:130:10)
    --------------------
    at Protocol._enqueue (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Protocol.handshake (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/protocol/Protocol.js:52:23)
    at Connection.connect (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/Connection.js:130:18)
    at Connection._implyConnect (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/Connection.js:461:10)
    at Connection.query (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/mysql/lib/Connection.js:206:8)
    at /home/hebert/Desktop/LTP4/Alura.node/casadocodigo/app/routes/product.js:20:15
    at Layer.handle [as handle_request] (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/hebert/Desktop/LTP4/Alura.node/casadocodigo/node_modules/express/lib/router/layer.js:95:5)
  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 }
undefined
1 resposta
solução!

Resolvi o problema com a seguinte solução:

Adicionei a variável 'insecureAuth', segue o código:

var connection = mysql.createConnection({ host : '-----------', user : '---------', password: '-------------', database: 'casadocodigo_nodejs', insecureAuth: 'FALSE' });

OBS; Sempre que instalar o MYSQL, nunca deixa a senha em vazio, mesmo alterando em outro momento, não ira conseguir conectar com a aplicação.