1
resposta

Erro de conexão - Containers

Crei os passo conforme informado no curso, criei o arquivo .env, e rodei o comando docker-compose up a partir da branch setup-inicial, porém o container app retorna esse erro:

Conexão com bd Error: Host '172.18.0.5' is not allowed to connect to this MySQL server app-1 | at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:728:17) app-1 | at ClientHandshake.execute (/app/node_modules/mysql2/lib/commands/command.js:29:26) app-1 | at PoolConnection.handlePacket (/app/node_modules/mysql2/lib/connection.js:489:32) app-1 | at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:94:12) app-1 | at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:75:16) app-1 | at Socket. (/app/node_modules/mysql2/lib/connection.js:101:25) app-1 | at Socket.emit (node:events:513:28) app-1 | at addChunk (node:internal/streams/readable:324:12) app-1 | at readableAddChunk (node:internal/streams/readable:297:9) app-1 | at Readable.push (node:internal/streams/readable:234:10) { app-1 | code: 'ER_HOST_NOT_PRIVILEGED', app-1 | errno: 1130, app-1 | sqlState: '', app-1 | sqlMessage: "Host '172.18.0.5' is not allowed to connect to this MySQL server", app-1 | sql: undefined app-1 | }

e o container seed retorna o erro:

seed-1 | ERROR 1130 (HY000): Host '172.18.0.4' is not allowed to connect to this MySQL server

Tentei acessar meu container do SQL com o comando:

docker exec -it mysql -u root -p

Quando coloco a senha retorna a mensagem:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Poderia me ajudar?

1 resposta

Oooi

Você pode executar o seguinte comando no MySQL para conceder acesso ao usuário 'root'@'172.18.0.5':

GRANT ALL PRIVILEGES ON . TO 'root'@'172.18.0.5' IDENTIFIED BY 'sua_senha' WITH GRANT OPTION; FLUSH PRIVILEGES;

Peguei a ideia daqui desse tópico:

https://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server