Intermittent ERROR: getaddrinfo EAI_AGAIN while fetching data from my SQL

Describe the issue/error/question

We are running workflow  that connect to my sql data to fetch some data . majority of time its working  but fails to fetch data from mysql sometime and  give  error "ERROR: getaddrinfo EAI_AGAIN mysql host info "

What is the error message (if any)?

    at Object.createConnection (/usr/local/lib/node_modules/n8n/node_modules/mysql2/promise.js:242:31)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/MySql/MySql.node.js:220:41)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:47
## Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

## Share the output returned by the last node
<!-- If you need help with transforming the data, please also share the expected output -->

## Information on your n8n setup
- **n8n version:0.148.0**
- **Database you're using (default: SQLite):**
- **Running n8n with the execution process [own(default), main]:**
- **Running n8n via Docker,**

Hi @jay.singh

The MySQL database from where you’re fetching the data is present in the same host machine or some external server?

If you’re trying with the hostname localhost please change it to and check.

mysql (the one I am pulling information is located in AWS datacenter),Problem is that its intermittent issue.out 20 sequence call only last 2 call fail,
Do you want me try by adding wait of one 1 sec for every call to mysql but that will delay over all process to linear time.

1 Like

Please give it a try.

1 Like

@jay.singh the MySQL connection being refused by the server sounds like a problem outside of n8n, but you might be able to mitigate it by making less connections.

Each run of a node creates a new connection, so if you run a node 20 times with one item in each run you’ll create 20 connections. However if you structure your workflow to use one run with 20 items, then you’ll only create one connection.

You could also try activating ‘retry on fail’ in the MySQL node settings if you haven’t done so that already.