node cookbook
N8N MySQL Node Cookbook
Use the MySQL node when a workflow needs to read, write, update, or query records in a MySQL-compatible database.
Independent third-party notes. n8n is a trademark of its owner and is referenced only for compatibility and troubleshooting context.
Quick Answer
Use the MySQL node when a workflow needs to read, write, update, or query records in a MySQL-compatible database.
Key Facts
- Node role
- Connect workflow steps to a MySQL database.
- Best fit
- Operational queries, record syncs, reporting, and database-backed automations.
- Credential need
- Requires MySQL connection credentials and network access from n8n.
- Common companion nodes
- Schedule Trigger, Webhook, IF, Set, Code, and Slack.
Recommended Steps
- Create MySQL credentials with the least permissions needed.
- Confirm n8n can reach the database host and port.
- Choose a safe read or write operation.
- Test with a small SELECT query or a non-production table.
- Add error handling for empty results and connection failures.
Verification
- Credentials connect successfully.
- A low-risk query returns expected rows.
- Write operations are tested safely before production use.
Warnings
- Do not use a broad admin database user for routine workflow automation.
- Large queries can increase memory pressure or slow executions.
Common Mistakes
- Using localhost from inside a Docker container when the database is elsewhere.
- Running wide SELECT queries that return too much data.
- Skipping SSL or network restrictions required by the database provider.
- Using a database user with unnecessary write permissions.
Examples
SELECT id, email, status
FROM leads
WHERE status = 'new'
LIMIT 10; FAQ
Is the MySQL node the same as n8n's internal database setting?
No. The MySQL node is for workflow data access. n8n's own internal database is configured separately.
Why does MySQL work on my laptop but not inside n8n Docker?
The container may not share your laptop's network context. Check hostnames, ports, firewall rules, and Docker networking.