Failing to connect graphql_engine to my mySQL container
See original GitHub issueHey folks, I have the following Docker container running :
version: "3.7"
services:
db:
image: mysql:8.0.14
command: --default-authentication-plugin=mysql_native_password
restart: always
volumes:
- "./data:/var/lib/mysql:rw"
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=root
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- 9090:80
environment:
- PMA_ARBITRARY=1
- UPLOAD_LIMIT=3000000000
Using the example from the docs I’m trying to launch a graphql_engine container to connect to my mySQL container so I have the following :
version: "3.6"
services:
postgres:
image: postgres:12
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:pull5655-633f084f
ports:
- "8080:8080"
depends_on:
- "postgres"
command:
- graphql-engine
- --mysql-host
- "127.0.0.1"
- --mysql-user
- "admin"
- --mysql-port
- "3306"
- --mysql-dbname
- "db_test"
- --mysql-password
- "admin"
- serve
restart: always
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
## enable the console served by server
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
## enable debugging mode. It is recommended to disable this in production
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
## uncomment next line to set an admin secret
# HASURA_GRAPHQL_ADMIN_SECRET: myadminsecretkey
volumes:
db_data:
I assume I’m not using the expected --mysql-host value here since I only get errors about the container not being able to connect to mysql.
If I use '127.0.0.1' or localhost I get a Can't connect to local MySQL server through socket error
My mySQL container is available on my host-machine localhost:3306 though via a SQL client.
Any pointers would be greatly appreciated 😄 Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
Why does my docker mysql database container refuse ...
To connect, you have to use the service name declared in your docker-compose.yml instead of container name.
Read more >MySQL preview | Hasura GraphQL Docs
Step 3: Run Hasura GraphQL engine. The following command will run Hasura along with a Postgres database required for its functioning. $ docker...
Read more >Hasura Console error: [...] No connection could be made ...
I believe the reason might be that the graphql-engine wasn't running. Try this: Run hasura init; In the root directory create docker-compose.yaml file...
Read more >Unable to connect to MySQL server (Docker)
I have set up a Docker container with a MySQL server running version 8.0.21 (also tried 8.0). Whenever I try to connect to...
Read more >Cricket database schema - Seba Online
of editing this file, please use the migrations feature of Cricket Match ... Students and Projects Lovers can Download Projects with MySQL Database...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Nervermind, sorted it, thanks
I’m also running into this issue what’s interesting is the different error messages based on which host I use.
If I use 127.0.0.1 or my actual IP address 192.168.2.191 I get this error:
If I use localhost I get this one: