SQL Connection via SSH Tunnel doesn't work in SQL Agent

Describe the problem/error/question

I try to set up an SQL Agent with an SSH tunneled connection. While connections with the same parameters work fine from MySQL Workbench, the agent returns an error message, when issuing a chat message to it. Though the connection tests run upon saving are successful.

What is the error message (if any)?

Stack trace:

Error: connect ECONNREFUSED ::1:3306 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1611:16)

Please share your workflow

Share the output returned by the last node

See error message

Information on your n8n setup

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

Hello!

I had some issues before with MySQL and SQL Agent. Not sure it is the same thing that is causing you the issues, but the way I got it to work was.

  • Whitelist all of n8n IPs on MySQL server.
  • Activate a SSL Certificate on my server. (MySQL nodes worked without this, but SQL Agent didn’t)

Hope this helps :slight_smile: