<p><img class="alignnone size-full wp-image-4363" src="https://flowgenius.in/wp-content/uploads/2026/01/Child-18-Cluster-9.png" alt="" /></p>
<p style="text-align: center;">Step by Step Guide to solve n8n MySQL node connection timeout</p>
<hr />
<p> </p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Who this is for: </strong>Developers and DevOps engineers running n8n workflows that need reliable MySQL connectivity in Docker, Kubernetes, or self‑hosted environments. <strong>We cover this in detail in the</strong> <a href="https://flowgenius.in/n8n-node-errors-troubleshooting/">n8n Node Specific Errors Guide.</a></p>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">Quick Diagnosis: Fix the timeout in 5 minutes</h2>
<ol style="margin-bottom: 1.8em; line-height: 1.9;">
<li>Verify you can reach MySQL from the n8n host (<code>nc -z <host> 3306</code>).</li>
<li>In the MySQL node, set <strong>Connect Timeout</strong> → <code>30000</code> ms (or higher).</li>
<li>Increase MySQL server variables <code>wait_timeout</code> and <code>interactive_timeout</code> to ≥ 300 seconds.</li>
<li>If using SSL, add the correct <code>ca.pem</code>/<code>cert.pem</code> files and enable <strong>TLS 1.2</strong>.</li>
<li>Restart the workflow – the node should now connect without timing out.</li>
</ol>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">1. What the “Connection timeout” error really means</h2>
<p><strong>If you encounter any</strong> <a href="/n8n-smtp-node-send-failure">n8n smtp node send failure</a><strong> resolve them before continuing with the setup.</strong></p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Symptom</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Typical n8n log line</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Error: MySQL node connection timeout after 10000 ms</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">2024-09-01 12:34:56 – error – MySQL node connection timeout after 10000 ms</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Error: ECONNREFUSED</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">… – error – connect ECONNREFUSED 10.0.2.5:3306</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Error: ER_ACCESS_DENIED_ERROR</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">… – error – ER_ACCESS_DENIED_ERROR: Access denied for user</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Underlying cause</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">
<ul style="margin: 0; padding-left: 1.2em;">
<li>n8n could not establish a TCP socket within the configured timeout.</li>
<li>The server rejected the connection (firewall, bind address, wrong port).</li>
<li>Authentication succeeded but the server closed the socket after the handshake (often a <code>wait_timeout</code> issue).</li>
</ul>
</td>
</tr>
</tbody>
</table>
<blockquote style="margin-bottom: 2em; line-height: 1.9; border-left: 4px solid #e0e0e0; padding-left: 1em;"><p><strong>EEFA note:</strong> In production, a timeout often masks a deeper network policy (e.g., security groups, VPC peering) that silently drops packets after a few seconds. Always confirm connectivity before tweaking n8n settings.</p></blockquote>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">2. Common root‑causes for MySQL node timeouts in n8n</h2>
<p><strong>If you encounter any</strong> <a href="/n8n-excel-node-file-corruption">n8n excel node file corruption</a><strong> resolve them before continuing with the setup.</strong></p>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Category</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Typical trigger</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Network path</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">VPC firewall, Docker bridge, VPN split‑tunnel</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">MySQL server config</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>wait_timeout</code> < <code>connect_timeout</code></td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">n8n node config</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Default <strong>Connect Timeout</strong> = 10 000 ms (insufficient for high latency)</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">TLS/SSL mismatch</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Missing CA bundle or outdated TLS version</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Connection pooling</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Reusing stale sockets after a server restart</td>
</tr>
</tbody>
</table>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Quick verification</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">
<ul style="margin: 0; padding-left: 1.2em;">
<li><code>nc -zvw5 <mysql-host> 3306</code> from the n8n container</li>
<li><code>SHOW VARIABLES LIKE 'wait_timeout';</code></li>
<li>Check node UI → *Advanced* → *Connect Timeout*</li>
<li>Look for <code>TLS handshake timeout</code> in n8n logs</li>
<li>Enable *Force New Connection* in node options</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">3. Step‑by‑step: Verify raw connectivity</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">*Confirm the network and MySQL handshake work before changing any n8n settings.*</p>
<p><strong>We cover this in detail in the</strong> <a href="/n8n Node-Specific Errors Guide">n8n Node Specific Errors Guide</a></p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;"># Test TCP reachability
nc -zvw5 mysql.example.com 3306
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Expected output:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">Connection to mysql.example.com 3306 port [tcp/mysql] succeeded!
</pre>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;"># Test MySQL handshake without authentication
mysql -h mysql.example.com -P 3306 -u dummy -pdummy --connect-timeout=5 -e "SELECT 1;"
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">You should see <code>1</code> or a clear authentication error—not a timeout. If either command fails, fix firewalls, VPC routes, or DNS first.</p>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">4. Configure the MySQL node for longer timeouts</h2>
<p><strong>If you encounter any </strong><a href="/n8n-wait-node-timeout">n8n wait node timeout </a><strong>resolve them before continuing.</strong></p>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Purpose:</strong> Extend the socket‑creation window so high‑latency or busy networks can complete the handshake.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.1 Set the timeout in the node UI</h3>
<ol style="margin-bottom: 1.8em; line-height: 1.9;">
<li>Open the workflow → edit the <strong>MySQL</strong> node.</li>
<li>Click <strong>Advanced Settings</strong> → enable <strong>Custom Timeout</strong>.</li>
<li>Set <strong>Connect Timeout</strong> (ms) to a value that exceeds your worst‑case latency (e.g., <code>30000</code>).</li>
<li>(Optional) Enable <strong>Force New Connection</strong> to avoid re‑using stale sockets.</li>
</ol>
<h3 style="margin-bottom: 45px; line-height: 1.3;">4.2 JSON representation (for reference)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">{
"host": "mysql.example.com",
"port": 3306,
"user": "n8n_user",
"password": "••••••"
}
</pre>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">{
"connectTimeout": 30000,
"forceNewConnection": true
}
</pre>
<blockquote style="margin-bottom: 2em; line-height: 1.9; border-left: 4px solid #e0e0e0; padding-left: 1em;"><p><strong>EEFA tip:</strong> Avoid setting the timeout arbitrarily high (> 2 min) in production; it masks genuine network failures and can tie up worker threads.</p></blockquote>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">5. Tune MySQL server variables</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Purpose:</strong> Ensure the server does not close idle connections before n8n finishes its handshake.</p>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.1 Inspect current values</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">SHOW VARIABLES LIKE 'wait_timeout';
SHOW VARIABLES LIKE 'interactive_timeout';
SHOW VARIABLES LIKE 'connect_timeout';
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.2 Raise them to safe defaults (e.g., 300 seconds)</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">SET GLOBAL wait_timeout = 300;
SET GLOBAL interactive_timeout = 300;
SET GLOBAL connect_timeout = 10;
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">5.3 Persist the changes in <code>my.cnf</code></h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">[mysqld]
wait_timeout = 300
interactive_timeout = 300
connect_timeout = 10
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Restart MySQL to apply:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">systemctl restart mysqld # or `service mysql restart`
</pre>
<blockquote style="margin-bottom: 2em; line-height: 1.9; border-left: 4px solid #e0e0e0; padding-left: 1em;"><p><strong>EEFA warning:</strong> Raising <code>wait_timeout</code> too much can keep idle connections open, consuming resources. Monitor <code>SHOW PROCESSLIST;</code> after the change.</p></blockquote>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">6. SSL/TLS considerations (if your MySQL endpoint requires encryption)</h2>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Setting in n8n node</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Required file</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Common pitfalls</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Use TLS</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>ca.pem</code> (CA bundle)</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Wrong CA → handshake fails → timeout</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Client Cert</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>client-cert.pem</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Expired cert → connection reset</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Client Key</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;"><code>client-key.pem</code></td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Permissions too restrictive (600) → node can’t read</td>
</tr>
</tbody>
</table>
<h3 style="margin-bottom: 45px; line-height: 1.3;">6.1 JSON snippet for TLS configuration</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">{
"ssl": {
"ca": "/secrets/mysql/ca.pem",
"cert": "/secrets/mysql/client-cert.pem",
"key": "/secrets/mysql/client-key.pem"
}
}
</pre>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">{
"ssl": {
"rejectUnauthorized": true
}
}
</pre>
<h3 style="margin-bottom: 45px; line-height: 1.3;">6.2 Verify the TLS handshake manually</h3>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">openssl s_client -connect mysql.example.com:3306 -CAfile /secrets/mysql/ca.pem
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">If the handshake stalls, the timeout will reappear – fix the certificate chain first.</p>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">7. Debugging with n8n logs</h2>
<p style="margin-bottom: 2em; line-height: 1.9;"><strong>Enable debug logging</strong> in <code>~/.n8n/config</code>:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">[logging]
level = "debug"
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Watch the logs while the workflow runs:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">docker logs -f n8n_container
# Look for lines containing “MySQL node” and “timeout”
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">Typical useful output:</p>
<pre style="background: #fafafa; padding: 20px; border: 1px solid #e0e0e0; overflow: auto; margin-bottom: 2em;">2024-09-01 12:34:56 - debug - MySQL node: establishing TCP connection to mysql.example.com:3306
2024-09-01 12:34:56 - error - MySQL node connection timeout after 30000 ms
</pre>
<p style="margin-bottom: 2em; line-height: 1.9;">If you see “TLS handshake timeout”, revisit the SSL/TLS step.</p>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">8. Checklist – Resolve MySQL node timeout</h2>
<ul style="margin-bottom: 1.8em; line-height: 1.9;">
<li><strong>Network reachable</strong> – <code>nc</code> succeeds from n8n host.</li>
<li><strong>MySQL node timeout</strong> set ≥ 30 000 ms (or appropriate for latency).</li>
<li><strong>Server variables</strong> <code>wait_timeout</code> & <code>interactive_timeout</code> ≥ 300 s.</li>
<li><strong>SSL files</strong> present, correct permissions, and match server config.</li>
<li><strong>Force New Connection</strong> enabled if using connection pooling.</li>
<li><strong>n8n logs</strong> show successful “connected” message, not “timeout”.</li>
</ul>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">9. Frequently asked questions</h2>
<table style="border-collapse: collapse; width: 100%; margin-bottom: 2em;">
<thead>
<tr>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Question</th>
<th style="border: 1px solid #e0e0e0; padding: 13px;">Answer</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Why does increasing the node timeout not help?</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">The TCP packets never reach the MySQL host (firewall/VPC). Fix network first.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Can I set the timeout per workflow instead of per node?</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">No. n8n’s MySQL node only respects the **Connect Timeout** field; workflow‑level timeouts affect the whole execution, not socket creation.</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Is there a way to auto‑retry on timeout?</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Wrap the MySQL node in an **IF** block with a **Retry** node (set retries = 3, delay = 5 s).</td>
</tr>
<tr>
<td style="border: 1px solid #e0e0e0; padding: 13px;">My server uses <code>max_allowed_packet=64M</code>; does that affect timeout?</td>
<td style="border: 1px solid #e0e0e0; padding: 13px;">Only if your query exceeds the packet size – you’ll get “Packet too large” instead of a timeout.</td>
</tr>
</tbody>
</table>
<h2 style="margin-bottom: 45px; line-height: 1.3;"></h2>
<div style="margin: 55px 0;">
<hr />
</div>
<h2 style="margin-bottom: 45px; line-height: 1.3;">Conclusion</h2>
<p style="margin-bottom: 2em; line-height: 1.9;">A MySQL connection timeout in n8n is almost always a network or server‑configuration issue, not a bug in the node itself. By confirming raw connectivity, extending the node’s **Connect Timeout**, and aligning MySQL’s <code>wait_timeout</code>/<code>interactive_timeout</code> with your workflow latency, you eliminate the most common failure points. When TLS is required, ensure the full certificate chain is available and correctly referenced. Following the checklist above guarantees a robust, production‑ready MySQL integration that respects both security and performance constraints.</p>

Step by Step Guide to solve n8n MySQL node connection timeout
Who this is for: Developers and DevOps engineers running n8n workflows that need reliable MySQL connectivity in Docker, Kubernetes, or self‑hosted environments. We cover this in detail in the n8n Node Specific Errors Guide.
Quick Diagnosis: Fix the timeout in 5 minutes
- Verify you can reach MySQL from the n8n host (
nc -z <host> 3306).
- In the MySQL node, set Connect Timeout →
30000 ms (or higher).
- Increase MySQL server variables
wait_timeout and interactive_timeout to ≥ 300 seconds.
- If using SSL, add the correct
ca.pem/cert.pem files and enable TLS 1.2.
- Restart the workflow – the node should now connect without timing out.
1. What the “Connection timeout” error really means
If you encounter any n8n smtp node send failure resolve them before continuing with the setup.
| Symptom |
Typical n8n log line |
| Error: MySQL node connection timeout after 10000 ms |
2024-09-01 12:34:56 – error – MySQL node connection timeout after 10000 ms |
| Error: ECONNREFUSED |
… – error – connect ECONNREFUSED 10.0.2.5:3306 |
| Error: ER_ACCESS_DENIED_ERROR |
… – error – ER_ACCESS_DENIED_ERROR: Access denied for user |
| Underlying cause |
- n8n could not establish a TCP socket within the configured timeout.
- The server rejected the connection (firewall, bind address, wrong port).
- Authentication succeeded but the server closed the socket after the handshake (often a
wait_timeout issue).
|
EEFA note: In production, a timeout often masks a deeper network policy (e.g., security groups, VPC peering) that silently drops packets after a few seconds. Always confirm connectivity before tweaking n8n settings.
2. Common root‑causes for MySQL node timeouts in n8n
If you encounter any n8n excel node file corruption resolve them before continuing with the setup.
| Category |
Typical trigger |
| Network path |
VPC firewall, Docker bridge, VPN split‑tunnel |
| MySQL server config |
wait_timeout < connect_timeout |
| n8n node config |
Default Connect Timeout = 10 000 ms (insufficient for high latency) |
| TLS/SSL mismatch |
Missing CA bundle or outdated TLS version |
| Connection pooling |
Reusing stale sockets after a server restart |
| Quick verification |
nc -zvw5 <mysql-host> 3306 from the n8n container
SHOW VARIABLES LIKE 'wait_timeout';
- Check node UI → *Advanced* → *Connect Timeout*
- Look for
TLS handshake timeout in n8n logs
- Enable *Force New Connection* in node options
|
3. Step‑by‑step: Verify raw connectivity
*Confirm the network and MySQL handshake work before changing any n8n settings.*
We cover this in detail in the n8n Node Specific Errors Guide
# Test TCP reachability
nc -zvw5 mysql.example.com 3306
Expected output:
Connection to mysql.example.com 3306 port [tcp/mysql] succeeded!
# Test MySQL handshake without authentication
mysql -h mysql.example.com -P 3306 -u dummy -pdummy --connect-timeout=5 -e "SELECT 1;"
You should see 1 or a clear authentication error—not a timeout. If either command fails, fix firewalls, VPC routes, or DNS first.
4. Configure the MySQL node for longer timeouts
If you encounter any n8n wait node timeout resolve them before continuing.
Purpose: Extend the socket‑creation window so high‑latency or busy networks can complete the handshake.
4.1 Set the timeout in the node UI
- Open the workflow → edit the MySQL node.
- Click Advanced Settings → enable Custom Timeout.
- Set Connect Timeout (ms) to a value that exceeds your worst‑case latency (e.g.,
30000).
- (Optional) Enable Force New Connection to avoid re‑using stale sockets.
4.2 JSON representation (for reference)
{
"host": "mysql.example.com",
"port": 3306,
"user": "n8n_user",
"password": "••••••"
}
{
"connectTimeout": 30000,
"forceNewConnection": true
}
EEFA tip: Avoid setting the timeout arbitrarily high (> 2 min) in production; it masks genuine network failures and can tie up worker threads.
5. Tune MySQL server variables
Purpose: Ensure the server does not close idle connections before n8n finishes its handshake.
5.1 Inspect current values
SHOW VARIABLES LIKE 'wait_timeout';
SHOW VARIABLES LIKE 'interactive_timeout';
SHOW VARIABLES LIKE 'connect_timeout';
5.2 Raise them to safe defaults (e.g., 300 seconds)
SET GLOBAL wait_timeout = 300;
SET GLOBAL interactive_timeout = 300;
SET GLOBAL connect_timeout = 10;
5.3 Persist the changes in my.cnf
[mysqld]
wait_timeout = 300
interactive_timeout = 300
connect_timeout = 10
Restart MySQL to apply:
systemctl restart mysqld # or `service mysql restart`
EEFA warning: Raising wait_timeout too much can keep idle connections open, consuming resources. Monitor SHOW PROCESSLIST; after the change.
6. SSL/TLS considerations (if your MySQL endpoint requires encryption)
| Setting in n8n node |
Required file |
Common pitfalls |
| Use TLS |
ca.pem (CA bundle) |
Wrong CA → handshake fails → timeout |
| Client Cert |
client-cert.pem |
Expired cert → connection reset |
| Client Key |
client-key.pem |
Permissions too restrictive (600) → node can’t read |
6.1 JSON snippet for TLS configuration
{
"ssl": {
"ca": "/secrets/mysql/ca.pem",
"cert": "/secrets/mysql/client-cert.pem",
"key": "/secrets/mysql/client-key.pem"
}
}
{
"ssl": {
"rejectUnauthorized": true
}
}
6.2 Verify the TLS handshake manually
openssl s_client -connect mysql.example.com:3306 -CAfile /secrets/mysql/ca.pem
If the handshake stalls, the timeout will reappear – fix the certificate chain first.
7. Debugging with n8n logs
Enable debug logging in ~/.n8n/config:
[logging]
level = "debug"
Watch the logs while the workflow runs:
docker logs -f n8n_container
# Look for lines containing “MySQL node” and “timeout”
Typical useful output:
2024-09-01 12:34:56 - debug - MySQL node: establishing TCP connection to mysql.example.com:3306
2024-09-01 12:34:56 - error - MySQL node connection timeout after 30000 ms
If you see “TLS handshake timeout”, revisit the SSL/TLS step.
8. Checklist – Resolve MySQL node timeout
- Network reachable –
nc succeeds from n8n host.
- MySQL node timeout set ≥ 30 000 ms (or appropriate for latency).
- Server variables
wait_timeout & interactive_timeout ≥ 300 s.
- SSL files present, correct permissions, and match server config.
- Force New Connection enabled if using connection pooling.
- n8n logs show successful “connected” message, not “timeout”.
9. Frequently asked questions
| Question |
Answer |
| Why does increasing the node timeout not help? |
The TCP packets never reach the MySQL host (firewall/VPC). Fix network first. |
| Can I set the timeout per workflow instead of per node? |
No. n8n’s MySQL node only respects the **Connect Timeout** field; workflow‑level timeouts affect the whole execution, not socket creation. |
| Is there a way to auto‑retry on timeout? |
Wrap the MySQL node in an **IF** block with a **Retry** node (set retries = 3, delay = 5 s). |
My server uses max_allowed_packet=64M; does that affect timeout? |
Only if your query exceeds the packet size – you’ll get “Packet too large” instead of a timeout. |
Conclusion
A MySQL connection timeout in n8n is almost always a network or server‑configuration issue, not a bug in the node itself. By confirming raw connectivity, extending the node’s **Connect Timeout**, and aligning MySQL’s wait_timeout/interactive_timeout with your workflow latency, you eliminate the most common failure points. When TLS is required, ensure the full certificate chain is available and correctly referenced. Following the checklist above guarantees a robust, production‑ready MySQL integration that respects both security and performance constraints.