MySQL n8n integrationAutomate MySQL with n8n.
Your MySQL server can become the memory of every workflow you build. The MySQL n8n integration exposes 6 operations on one Database resource, from a filtered Select to raw SQL. No trigger node ships with it, so a Schedule Trigger or a Webhook starts the run.
Verified Trustpilot reviews · AI, automation & growth agency
What does the MySQL n8n integration actually do?
The MySQL n8n integration is the MySQL node that ships with n8n: one Database resource and 6 operations aimed at your server, Select, Insert, Insert or Update, Update, Delete and Execute SQL for everything else. n8n opens the connection with the credential you saved, runs the statement, and hands the rows to the next node as ordinary items. Nothing gets installed on the database side.
A reporting workflow is the easiest starting point. A Schedule Trigger fires early in the morning, database.select reads the orders of the previous day with a condition on the date column, and the rows land in a Slack channel as a short digest. Nobody opens a SQL client, nobody exports anything.
The second pattern runs the other way: data arrives and has to be stored. Rows pulled from a Google Sheets tab, a CSV parsed by a previous node, a form submission, all of them end in database.insert, where Auto-Map Input Data to Columns does the mapping as long as the field names already match the column names.
The third one keeps two systems aligned. database.upsert takes a Column to Match On, usually an email or an external identifier, then decides row by row whether to update or create. Running the same import twice changes nothing the second time, which is what makes it safe to schedule.
When an operation is missing, there is no API to fall back on here: MySQL speaks SQL, so database.executeQuery is the escape hatch. Joins, aggregates, a WHERE clause on two columns, anything the five typed operations do not expose goes through it, with Query Parameters standing in for the values instead of string concatenation. Teams already automating Postgres will recognize the layout, since the node is built the same way.
Two limits are worth knowing before you plan the workflow. There is no MySQL trigger node, so every run starts on a Schedule Trigger, a Webhook, or the trigger of another tool. And the node returns DECIMAL values as strings by default, which catches out the first workflow that tries to add them up. The rest is ordinary database work: the n8n review looks at how the platform holds up on bigger jobs, and the n8n training walks through building these workflows step by step.
How do you connect MySQL to n8n?
- 01
Create the database user
The MySQL side comes first. A user account has to exist on the server, with permissions matching what the workflow will do: read-only rights are enough for a node that only selects, while inserts, updates and deletes need write rights on the target tables. That account name and its password are what you type into User and Password.
- 02
Fill in the database connection
In n8n, open the Credentials menu and create a MySQL credential, reused from the node dropdown in every workflow. Host takes the host name or IP address, Database the database name, Port the listening port,
3306unless it was changed. Connect Timeout counts in milliseconds and defaults to10000, the ten seconds MySQL uses. - 03
Turn on SSL or an SSH tunnel
SSL takes your certificate file contents:
ca.pemin CA Certificate,client-key.pemin Client Private Key,client-cert.pemin Client Certificate. SSH Tunnel wraps the connection in an encrypted channel, with SSH Host, SSH Port, SSH User and a password or a private key.
What can the MySQL node do?
The MySQL node exposes 6 operations across 1 resources. For each one: the node as you configure it in n8n, the required fields, and our field notes.
| Resource | Update | Delete | Execute SQL | Insert | Select | Insert or Update |
|---|---|---|---|---|---|---|
| Database | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Operations index
Database
6 operationsDelete table or rows
database.deleteTableWhat you see in n8n
Notes & use cases
Three different jobs hide behind one operation, and the Command field decides which one runs: empty the table, remove selected rows, or destroy the table for good.
Key parameters
- Command:
truncatewipes the data and keeps the table structure,deleteremoves only the rows matching your conditions,dropdeletes data and structure permanently. - Select Rows: the conditions applied when Command is
delete; left empty, every row in the table goes. - Combine Conditions:
ANDkeeps rows that meet all conditions,ORkeeps rows that meet at least one.
Execute a SQL query
database.executeQueryWhat you see in n8n
Notes & use cases
When the typed operations stop being enough, this one sends raw SQL to the server and returns whatever the statement produces: a join across several tables, an aggregate, a conditional update.
Key parameters
- Query: required, the statement itself, for example
SELECT id, name FROM product WHERE id < 40. - Query Parameters: a comma separated list of values referenced in the query as
$1,$2,$3, the way to keep incoming data out of the statement text and block SQL injection. - Query Batching:
singlesends one query for all incoming items,independentlyruns one query per item,transactionrolls everything back if one statement fails.
Insert rows in a table
database.insertWhat you see in n8n
Notes & use cases
Each incoming item becomes a new row. The node writes the INSERT statement for you, so the only real question is how item fields map to table columns.
Key parameters
- Data Mode:
autoMapInputDatamatches item property names to column names,defineBelowlets you set every destination column by hand. - Values to Send: in manual mode, the column and value pairs written into the row, values usually coming from an expression such as
{{ $json.email }}. - Replace Empty Strings with NULL: worth enabling when the rows come from a spreadsheet, where blank cells arrive as empty strings.
Insert or update rows in a table
database.upsertWhat you see in n8n
Notes & use cases
Duplicates are the problem this operation solves. It looks for the row first, updates it when it exists, creates it when it does not, one incoming item at a time.
Key parameters
- Column to Match On: required, the column used to find the row to update; it has to be unique and the operation never changes it.
- Value of Column to Match On: the value compared against that column, items with no match create new rows.
- Data Mode: auto map when the item properties already carry the exact column names, manual when the source names differ.
Select rows from a table
database.selectWhat you see in n8n
Notes & use cases
Reading comes with a small query builder: pick the table, add conditions, sort, and the matching rows arrive as items the rest of the workflow can use.
Key parameters
- Return All: on, every matching row comes back; off, Limit caps how many rows the node returns.
- Select Rows and Operator: the conditions, including
LIKE, where%stands for any number of characters and_for a single one. - Sort and Direction: order the result,
ASCorDESC, before it leaves the node. - Output Columns: keep only the columns the next node actually needs.
Update rows in a table
database.updateWhat you see in n8n
Notes & use cases
Existing rows only. The node finds the ones that match and rewrites the columns you listed, without ever creating a new record.
Key parameters
- Column to Match On: required, the column that identifies the rows to update, left untouched by the write itself.
- Value of Column to Match On: the value it gets compared to, often
{{ $json.id }}coming from the previous node. - Values to Send: the columns to rewrite and their new values.
Need help automating MySQL with n8n?
A person reads every message.
