Solucionado (ver solução)
Solucionado
(ver solução)
7
respostas

HELPME -> (node:86013) UnhandledPromiseRejectionWarning: SequelizeConnectionError:

esse erro aparece após o comendo: node api/database/createTables.js

não sei se tem haver com permissões...

(node:86013) UnhandledPromiseRejectionWarning: SequelizeConnectionError: Access denied for user 'root'@'localhost' at ConnectionManager.connect (/home/nathanjfa/Documents/api-rustic/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:102:17) at process.tickCallback (internal/process/nexttick.js:68:7) (node:86013) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:86013) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

7 respostas

Compartilha seu codigo

Rodrigo, eu tentei com o mesmo código que foi disponibilizado na etapa 1 do curso, e ainda deu erro de conexão.

percebe-se que não é o mesmo erro, porém todos dois derivam de SequelizeConnectionError..

eu chego a achar que é algo nas permissões do linux com o mysql. pois se eu executar como sudo, ele loga no mysql sem precisar inserir a senha do default.json

{ SequelizeConnectionError: Access denied for user 'root'@'localhost' at ConnectionManager.connect (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:126:17) at process.tickCallback (internal/process/nexttick.js:68:7) name: 'SequelizeConnectionError', parent: { Error: Access denied for user 'root'@'localhost' at Packet.asError (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/packets/packet.js:712:17) at ClientHandshake.execute (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/commands/command.js:28:26) at Connection.handlePacket (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:417:32) at PacketParser.Connection.packetParser.p [as onPacket] (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:75:12) at PacketParser.executeStart (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/packet_parser.js:75:16) at Socket.Connection.stream.on.data (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:82:25) at Socket.emit (events.js:198:13) at addChunk (streamreadable.js:288:12) at readableAddChunk (streamreadable.js:269:11) at Socket.Readable.push (streamreadable.js:224:10) code: 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR', errno: 1698, sqlState: '28000', sqlMessage: 'Access denied for user 'root'@'localhost'' }, original: { Error: Access denied for user 'root'@'localhost' at Packet.asError (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/packets/packet.js:712:17) at ClientHandshake.execute (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/commands/command.js:28:26) at Connection.handlePacket (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:417:32) at PacketParser.Connection.packetParser.p [as onPacket] (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:75:12) at PacketParser.executeStart (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/packet_parser.js:75:16) at Socket.Connection.stream.on.data (/home/nathanjfa/Documents/Curso NodeJS arquivos da aula/pt1/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:82:25) at Socket.emit (events.js:198:13) at addChunk (streamreadable.js:288:12) at readableAddChunk (streamreadable.js:269:11) at Socket.Readable.push (streamreadable.js:224:10) code: 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR', errno: 1698, sqlState: '28000', sqlMessage: 'Access denied for user 'root'@'localhost'' } }

e detalhe..

se eu colocar no terminal

sudo mysql -u root -h 127.0.0.1 -p -> ele não passa de jeito nenhum, dá acesso negado

sudo mysql -u root -p -> ele entra no mysql com qualquer senha, mesmo errada.

sem o sudo ele não vai de jeito nenhum.

enfim, só consigo entrar no no mysql assim -> sudo mysql -u root -p

Pode ser questão da porta do mysql tenta ver se esta conectado na porta padrao que é 3306

Mesmo mudando a porta, não vai. você usa linux?

qualquer coisa se quiser entrar discord pra tentar algo, eu transmito tela e tal. NathanJFA #0427

nathanjfa@nathanjfa-Inspiron-7560:~/Documents/api-petshop-aula-1$ sudo node api/banco-de-dados/criarTabelas.js { SequelizeConnectionError: Access denied for user 'root'@'localhost' at ConnectionManager.connect (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:102:17) at process.tickCallback (internal/process/nexttick.js:68:7) name: 'SequelizeConnectionError', parent: { Error: Access denied for user 'root'@'localhost' at Packet.asError (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/packets/packet.js:728:17) at ClientHandshake.execute (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/commands/command.js:29:26) at Connection.handlePacket (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:456:32) at PacketParser.Connection.packetParser.p [as onPacket] (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:85:12) at PacketParser.executeStart (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/packet_parser.js:75:16) at Socket.Connection.stream.on.data (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:92:25) at Socket.emit (events.js:198:13) at addChunk (streamreadable.js:288:12) at readableAddChunk (streamreadable.js:269:11) at Socket.Readable.push (streamreadable.js:224:10) code: 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR', errno: 1698, sqlState: '28000', sqlMessage: 'Access denied for user 'root'@'localhost'', sql: undefined }, original: { Error: Access denied for user 'root'@'localhost' at Packet.asError (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/packets/packet.js:728:17) at ClientHandshake.execute (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/commands/command.js:29:26) at Connection.handlePacket (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:456:32) at PacketParser.Connection.packetParser.p [as onPacket] (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:85:12) at PacketParser.executeStart (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/packet_parser.js:75:16) at Socket.Connection.stream.on.data (/home/nathanjfa/Documents/api-petshop-aula-1/node_modules/mysql2/lib/connection.js:92:25) at Socket.emit (events.js:198:13) at addChunk (streamreadable.js:288:12) at readableAddChunk (streamreadable.js:269:11) at Socket.Readable.push (streamreadable.js:224:10) code: 'ER_ACCESS_DENIED_NO_PASSWORD_ERROR', errno: 1698, sqlState: '28000', sqlMessage: 'Access denied for user 'root'@'localhost'', sql: undefined } }

solução!

Cara, o problema era no meu mysql ele não estava com a senha padrão, e só executava com o sudo.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'insert_password';

esse comando me salvou, serve pra alterar a senha do MySql.