Connect ECONNREFUSED 127.0.0.1:3306

I’m having trouble connecting to my MySQL server, which is running in a Docker container. I’m 100% sure of the details of my setup, host name, DB, user, password. Yet no luck. I get hits error: Couldn’t connect with these settings
Retry
connect ECONNREFUSED 127.0.0.1:3306

I’ve verified the following:
The MySQL server is running in the Docker container.
The bind_address is set to *.
I can connect to the MySQL server using the command line from within the Docker container.
The user root has access from both localhost and %.
Despite this, I cannot connect to the MySQL server from n8n. I’ve double-checked the connection settings, but it still fails.
I’ve checked countless cases, and none of them help.
I’ve already reversed the Docker IP address, I did it locally, I’ve made sure everything is working, and it still doesn’t work.
Has anyone been able to resolve this yet?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @alpreb
Sounds like it might be a Docker networking issue from inside the n8n container. 127.0.0.1 points to n8n itself, not MySQL. Are both containers on the same Docker network, and are you using the MySQL container/service name as the host? If you’re on docker-compose, could you share your service setup?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.