Resources · n8n integration

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

Why automate

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.

Connect

How do you connect MySQL to n8n?

  1. 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.

  2. 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, 3306 unless it was changed. Connect Timeout counts in milliseconds and defaults to 10000, the ten seconds MySQL uses.

  3. 03

    Turn on SSL or an SSH tunnel

    SSL takes your certificate file contents: ca.pem in CA Certificate, client-key.pem in Client Private Key, client-cert.pem in 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.

Actions

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.

Resources × operations matrix
ResourceUpdateDeleteExecute SQLInsertSelectInsert or Update
Database✓✓✓✓✓✓

Database

6 operations
01

Delete table or rows

database.deleteTable

What 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: truncate wipes the data and keeps the table structure, delete removes only the rows matching your conditions, drop deletes data and structure permanently.
  • Select Rows: the conditions applied when Command is delete; left empty, every row in the table goes.
  • Combine Conditions: AND keeps rows that meet all conditions, OR keeps rows that meet at least one.
Use cases
clearing a staging table at the start of a nightly reload, or removing the rows of a customer who asked for their data to be erased.
02

Execute a SQL query

database.executeQuery

What 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: single sends one query for all incoming items, independently runs one query per item, transaction rolls everything back if one statement fails.
Use cases
updating a row identified by two columns at once, which the typed Update cannot match on.
03

Insert rows in a table

database.insert

What 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: autoMapInputData matches item property names to column names, defineBelow lets 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.
Use cases
loading a CSV file into a MySQL table, or archiving every form submission as it arrives.
04

Insert or update rows in a table

database.upsert

What 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.
Use cases
a customer table fed by a CRM export and matched on the email column, so a second import updates instead of duplicating.
05

Select rows from a table

database.select

What 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, ASC or DESC, before it leaves the node.
  • Output Columns: keep only the columns the next node actually needs.
Use cases
pulling the orders of the previous day every morning to build a report.
06

Update rows in a table

database.update

What 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.
Use cases
flipping an order status once a payment lands. One limit to keep in mind: a table whose rows need two columns to be identified cannot be matched here, and Execute SQL takes over.
Need help

Need help automating MySQL with n8n?

A person reads every message.

FAQ

MySQL and n8n: questions that come up

01Is the MySQL n8n integration free to use?
Yes, nothing extra to pay on the n8n side. The MySQL node comes bundled with every install, so there is no package to add and no plan to upgrade, on n8n Cloud as much as on a self-hosted instance running the Community Edition under its Sustainable Use license. A workflow behaves exactly the same in both places. What this leaves out is the cost of the MySQL server itself, which depends on where the database lives and has nothing to do with n8n. The credential gets created once in the Credentials menu and reused everywhere, so a second workflow against the same database costs only the time it takes to pick it from the dropdown.
02What credentials does the MySQL node need?
A database connection, and that is the only authentication method the node supports. You fill in Host, Database, User, Password and Port, with 3306 as the usual MySQL port, plus a Connect Timeout expressed in milliseconds. The account has to exist on the MySQL server beforehand, and it needs the permissions matching what n8n will do: reading only, or reading and writing when the workflow inserts and updates. Two options harden the connection. SSL takes the contents of your ca.pem, client-key.pem and client-cert.pem files. An SSH Tunnel carries the traffic over an encrypted connection, authenticating with a password or with a private key and its passphrase.
03What are the limits of the MySQL node in n8n?
Three of them are worth knowing before you build. Reads stop early unless Return All is switched on, since Limit otherwise caps the number of rows returned. The Update operation matches on a single column, so a table whose rows need two columns to be identified has to go through Execute SQL, where the WHERE clause can name both. And types do not always survive the trip: DECIMAL values come back as strings on purpose, to avoid the precision loss JavaScript numbers would cause, unless you turn on Output Decimals as Numbers. For NUMERIC and BIGINT columns longer than 16 digits, set Output Large-Format Numbers As to text.
04Can a workflow react to a new row in MySQL?
Not on its own. n8n ships no MySQL trigger node, so nothing watches the database for you. A workflow that touches MySQL starts somewhere else: a Schedule Trigger firing at a fixed interval, followed by a Select that reads the rows added since the last run; an n8n Webhook, meaning a URL that a third-party service calls when something happens on its side; or the trigger of another tool in the same workflow. The scheduled pattern covers most needs, and the closer to immediate you want it, the shorter the interval. Watch the Connections Limit option when several workflows query the same server, since a high value can cost you in performance.
05n8n or Make for MySQL?
It depends on where you want the data to sit. n8n runs on your own server through Docker or npm, or on n8n Cloud, and the workflow is identical in both cases, so a database that never leaves your network can be automated by an instance that never leaves it either. Make is hosted only, with no self-hosting option, and bills per operation, which changes the arithmetic when a workflow loops over thousands of rows. Both build workflows visually, and both get the job done. The honest test is your own constraints: hosting, control over the data, cost model, and which visual logic your team reads faster.