Skip to main content

MySQL Component

Query and manage data in a MySQL Database

Component key: mysql · Source ·
· Changelog ↓

Description

MySQL is a popular relational database system. This component allows you to query a MySQL database.

MySQL parameterized queries

Instead of generating dynamic queries and sanitizing SQL manually, generic queries with parameter placeholders using the ? placeholder are supported. The placeholder can be used several times in a query, with a list of optional parameters provided to the action. For example, a query that reads INSERT INTO users (name, email) VALUES (?, ?) can be used. Then, configure the optional parameters input to look like the following: ["myUsername", "myEmail"] or any desired values. Values provided for name and email are sanitized automatically.

When dynamically generating SQL queries with an unknown number of parameters ahead of time, create a dynamic array of parameters in another step and reference them through the Reference Parameters input.

Bulk inserting data

When inserting an unknown number of rows of data into a table, the Reference Parameters input must be used, and the input must be a doubly-wrapped array.

For example, if the query reads INSERT INTO myTable (id, mycolumn1, mycolumn2) VALUES ?, the reference parameter should read something like

[
[
["3", "foo3", "bar3"],
["4", "foo4", "bar4"],
["5", "foo5", "bar5"]
]
]

Connections

On-Premise Connection

key: mySQL

Create a connection of type On-Premise Connection to authenticate with a MySQL server.

Configure the Connection

  • Host: The publicly-accessible address of the MySQL server (e.g., my-server.example.com)
  • Port: The port the database server is exposing (default: 3306)
  • Database: The name of the MySQL database to connect to
  • Username (optional): The username for authenticating with the MySQL server
  • Password (optional): The password for authenticating with the MySQL server

On-prem enabled: this connection can be configured to connect to an on-prem resource on a private network. Learn more.

InputNotesExample
Database

The name of the MySQL database to connect to.

Host

The publicly-accessible address of the MySQL server.

my-server.example.com
Password

The password for authenticating with the MySQL server.

Port

The port the database server is exposing.

3306
Username

The username for authenticating with the MySQL server.

Actions

Query Database

Executes a query against a MySQL database and returns the results. | key: query

InputNotesExample
Connection

The MySQL connection to use.

Parameters

The ordered list of values to bind to '?' placeholders in the query. Use this when the number of parameters is known at design time. Use either Parameters or Reference Parameters, not both.

Query

The SQL query to execute against the MySQL server. Use '?' placeholders for parameterized values.

SELECT * FROM users WHERE id = ?
Reference Parameters

A JSON array of values to bind to '?' placeholders, referenced from a previous step. Use this when the number of parameters is determined at runtime. Use either Parameters or Reference Parameters, not both.

["foo","bar"]
Example Payload for Query Database
Loading…

Changelog

2026-05-22

Various modernizations and documentation updates

2026-04-30

Updated spectral version

2026-04-07

Added global debug support across all actions for improved troubleshooting

2025-04-29

Added support for bulk inserts to improve performance when inserting multiple records