-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
Is this a docs issue?
- My issue is about the documentation content or website
Type of issue
Other
Description
I encounter an error when trying to run
docker run -dp 127.0.0.1:3000:3000
-w /app -v "$(pwd):/app"
--network todo-app
-e MYSQL_HOST=mysql
-e MYSQL_USER=root
-e MYSQL_PASSWORD=secret
-e MYSQL_DB=todos
node:18-alpine
sh -c "yarn install && yarn run dev"
The following is the error
Waiting for mysql:3306.
Connected!
Error: Host '172.18.0.3' is not allowed to connect to this MySQL server
at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:728:17)
at ClientHandshake.execute (/app/node_modules/mysql2/lib/commands/command.js:29:26)
at PoolConnection.handlePacket (/app/node_modules/mysql2/lib/connection.js:456:32)
at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:85:12)
at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:75:16)
at Socket. (/app/node_modules/mysql2/lib/connection.js:92:25)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10) {
code: 'ER_HOST_NOT_PRIVILEGED',
errno: 1130,
sqlState: '',
sqlMessage: "Host '172.18.0.3' is not allowed to connect to this MySQL server",
sql: undefined
}
MySQL don't allow 'root'@'172.18.0.3' to connect.
I can solve it by creating another MySQL user and connecting with the newly created user instead of root
Location
https://docs.docker.com/get-started/07_multi_container/
Suggestion
It's not friendly for new users. Hope you can fix it.