
MYSQL n8n INTEGRATION: AUTOMATE MYSQL WITH N8N
Looking to automate MySQL with n8n? You're in the right place. The MySQL n8n integration gives you direct access to 6 powerful actions that let you interact with your relational databases without writing a single line of backend code.
With this native integration, you can execute SQL queries, insert new records, update existing data, delete rows, and perform upsert operations—all triggered automatically by events from any of n8n's 400+ connected applications. Whether you're syncing customer data from your CRM, logging webhook events, or building a real-time data pipeline, this integration handles the heavy lifting.
In this guide, you'll discover exactly how to connect MySQL to n8n, explore each available action in detail, and learn practical tips to build robust database automations. Let's dive in.
Need help automating Mysql with n8n?
Our team will get back to you in minutes.
Why automate Mysql with n8n?
The MySQL n8n integration provides 6 distinct actions to manipulate your database programmatically: Select, Insert, Update, Delete, Insert or Update (upsert), and Execute SQL. This comprehensive toolkit covers virtually every database operation you'll need in an automation context.
Significant time savings are the first benefit you'll notice. Instead of manually exporting CSV files, running queries in phpMyAdmin, or building custom API endpoints, you set up your n8n workflow once and let it handle repetitive database tasks 24/7. A task that took 15 minutes per day suddenly takes zero—your workflow handles it in milliseconds.
Zero oversight and improved data integrity come naturally when you automate. Human error in manual data entry costs businesses billions annually. With n8n handling your MySQL operations, every record follows the exact same logic, every time. No typos, no forgotten fields, no "I'll do it later" that becomes never.
Concrete use cases include: automatically inserting new leads from a web form into your customer database, syncing inventory levels between your e-commerce platform and MySQL, logging every Slack message to a searchable database, cleaning up old records on a schedule, or building real-time dashboards that update as data flows in. The possibilities expand dramatically when you connect MySQL to n8n's ecosystem of integrations like HubSpot.
How to connect Mysql to n8n?
! 1 stepHow to connect Mysql to n8n?
- 01
Add the node
Search and add the node in your workflow.
TIP💡 TIP: Create a dedicated MySQL user specifically for n8n automations with only the permissions it needs (SELECT, INSERT, UPDATE, DELETE on specific tables). This follows the principle of least privilege and protects your database if credentials are ever compromised. Avoid using root credentials in production workflows. For more advanced database management, consider exploring Airtable as a complementary solution.- 01
Need help automating Mysql with n8n?
Our team will get back to you in minutes.
Mysql actions available in n8n
01 Action 01MySQL Update
The Update action modifies existing records in your MySQL database. When data changes in external systems—a customer updates their email, an order status changes, a subscription renews—this action ensures your database reflects the current state.
Key parameters: Credential to connect with (required dropdown to select your MySQL account credentials with edit icon for managing credentials), Operation (configured to "Update" to modify existing records rather than creating new ones, typically combined with conditions to target specific rows), and Table (required dropdown where you select which table contains the records you want to update, with "From list" option populating available tables from your connected database).
Use cases: Update customer email addresses when they change in your CRM, mark orders as "shipped" when your fulfillment system confirms dispatch, or increment a counter field each time a specific event occurs.

02 Action 02MySQL Select
The Select action retrieves data from your MySQL database based on criteria you define. This is your go-to operation when you need to fetch records to use in subsequent workflow steps—whether that's sending personalized emails, updating external systems, or making decisions based on database values.
Key parameters: Credential to connect with (required dropdown used to select an existing MySQL account credential configured within n8n, currently showing "MySQL account" with an edit icon for modifying credentials), Operation (required dropdown set to "Select" to retrieve data from the database), and Table (required field allowing you to specify which database table the operation will act upon, with dropdown set to "From list" and placeholder text "Select a Table...").
Use cases: Fetch all customers who signed up in the last 24 hours to send a welcome email sequence, retrieve product inventory levels to check stock before processing an order, or pull user preferences from a settings table to personalize notifications.

03 Action 03Insert or Update
The Insert or Update action (commonly called "upsert") intelligently handles records that may or may not already exist. If a matching record is found, it updates; if not, it inserts. This eliminates the need for complex "check-then-act" logic in your workflows.
Key parameters: Credential to connect with (required dropdown for selecting an existing MySQL account credential configured within n8n, set to "MySQL account" with an edit icon for modifications), Operation (required dropdown configured to "Insert or Update", indicating the action will either add new records or modify existing ones based on matching criteria defined in subsequent configuration steps), and Table (required field specifying which database table the operation will act upon, using a dropdown allowing selection "From list" with placeholder "Select a Table...").
Use cases: Sync contact information from your CRM—update if the contact exists, create if they're new, maintain a "last seen" timestamp for users that updates on each interaction, or keep inventory counts synchronized without worrying about whether a product record exists.

04 Action 04MySQL Insert Row
The Insert action adds new records to your MySQL database tables. Every time your workflow processes incoming data—whether from a webhook, form submission, or another application—this action creates a corresponding database entry.
Key parameters: Credential to connect with (required dropdown to select your pre-configured MySQL account credentials for secure database connection), Operation (set to "Insert" to add new data rows, with other operations like Update, Delete, and Select serving different purposes), and Table (required field consisting of two parts—a dropdown set to "From list" that lets you choose how to specify the table, and a selection field where you pick the specific table for insertion).
Use cases: Log every form submission from your website into a leads table, create order records when customers complete checkout in your WooCommerce e-commerce system, or insert webhook payloads as raw event logs for later analysis.

05 Action 05Execute SQL
The Execute SQL action gives you full control by letting you write and execute custom SQL queries. When the standard CRUD operations aren't enough—you need joins, aggregations, subqueries, or complex filtering—this action handles it.
Key parameters: Credential to connect with (required dropdown for selecting your pre-configured MySQL account credentials set to "MySQL account"), Operation (set to "Execute SQL" enabling custom query execution rather than predefined operations), Query (required multiline text input where you write your SQL statement, with interface reminder about using query parameters to prevent SQL injection attacks), and Options (optional expandable section where you can add query parameters and other advanced settings, currently showing "No properties" with an "Add option" button for adding parameters dynamically).
Use cases: Run complex SELECT queries with JOINs across multiple tables, execute aggregate functions (COUNT, SUM, AVG) for reporting workflows, or perform batch operations with a single optimized query.

06 Action 06MySQL Delete
The Delete action removes records from your MySQL database based on specified conditions. Use this for data cleanup, removing outdated entries, or implementing "hard delete" functionality in your applications.
Key parameters: Credential to connect with (required dropdown to select your MySQL account credentials for authentication), Operation (set to "Delete", indicating this action will remove rows from your specified table—always double-check your conditions before running delete operations), and Table (required field to specify which table to delete from, offering "Fixed" and "Expression" input methods where Fixed lets you select from a list while Expression allows dynamic table selection based on workflow data).
Use cases: Remove unverified user accounts older than 30 days, delete completed tasks from a queue table after processing, or clean up temporary session data on a scheduled basis.

07 Action 07💡 TIP: Always use parameterized queries in Execute SQL to pr
💡 TIP: Always use parameterized queries in Execute SQL to prevent SQL injection vulnerabilities. Instead of concatenating user input directly into your query string, use the Options section to define parameters. This is especially critical if your workflow processes data from untrusted sources like webhooks or form submissions. Learn more about prepared statements in the official MySQL documentation.
08 Action 08💡 TIP: Always use parameterized queries in Execute SQL to pr
💡 TIP: Always use parameterized queries in Execute SQL to prevent SQL injection vulnerabilities. Instead of concatenating user input directly into your query string, use the Options section to define parameters. This is especially critical if your workflow processes data from untrusted sources like webhooks or form submissions. Learn more about prepared statements in the official MySQL documentation.
Build your first workflow with our team
Drop your email and we'll send you the catalog of automations you can ship today.
- Free n8n & Make scenarios to import
- Step-by-step setup docs
- Live cohort + community support
Frequently asked questions
Is the MySQL n8n integration free?
Yes, the MySQL integration is included in n8n's core functionality at no additional cost. Whether you're using the free self-hosted version of n8n or a paid cloud plan, you have full access to all 6 MySQL actions. The only requirement is that your MySQL database is accessible from wherever n8n is running—this might mean configuring firewall rules or using SSH tunneling if your database is behind a private network. There are no per-query charges or API limits imposed by n8n itself; your only constraints are your MySQL server's capacity. If you're new to n8n, check out our comprehensive n8n review to get started.What data types can I work with using the MySQL n8n integration?
The n8n MySQL integration handles all standard MySQL data types including VARCHAR, TEXT, INT, DECIMAL, DATE, DATETIME, TIMESTAMP, BOOLEAN, JSON, and BLOB fields. When data flows through n8n, it's converted to JavaScript types (strings, numbers, objects, arrays) that you can manipulate with other nodes before writing back to MySQL. For binary data like images stored in BLOB fields, n8n handles the encoding/decoding automatically. JSON fields are particularly useful as they allow you to store complex nested data structures that n8n can read and write natively. You can also integrate with MongoDB for NoSQL data storage in the same workflow.How do I handle errors and failed queries in my MySQL n8n workflows?
n8n provides several mechanisms for error handling with MySQL operations. First, enable "Continue on Fail" in the node settings if you want your workflow to proceed even when a query fails—useful for batch operations where one bad record shouldn't stop everything. Second, use the Error Trigger node to create a separate workflow that activates when MySQL operations fail, allowing you to log errors, send alerts via Discord, or retry operations. Third, wrap sensitive operations in IF nodes that check for expected conditions before proceeding. For transactions requiring atomicity, use Execute SQL with explicit BEGIN, COMMIT, and ROLLBACK statements. For more details, visit our n8n troubleshooting guide.



