MySQL

MySQL is the world's most popular open-source relational database.

Overview

The MySQL connector lets your Spojit workflows query and mutate any MySQL or MySQL-compatible database (Aurora, MariaDB, PlanetScale, Cloud SQL). It exposes a small set of high-leverage tools - execute arbitrary SQL, insert/update/delete rows by table, and introspect schema - so workflows can drive decisions from live data or push computed results back.

Use it as a relational source-of-truth that feeds e-commerce, AI, or reporting workflows; as a destination for ETL pipelines that land CSV or JSON in normalized tables; or as a staging layer between operational systems where SQL is the cleanest expression of the join.

What You Can Do

The MySQL connector exposes these tools:

  • execute-query - Run any SQL statement (SELECT, INSERT, UPDATE, DELETE, DDL) with parameter binding.
  • insert-rows - Insert one or many rows into a table without writing SQL by hand.
  • update-rows - Update rows in a table matching a WHERE clause.
  • delete-rows - Delete rows from a table matching a WHERE clause.
  • list-databases - List databases visible to the connected user.
  • list-tables - List tables in a database.
  • describe-table - Return the column list, types, keys, and indexes for a table.

Authentication

The connector authenticates with host, port, database, username, and password. Get these from your database admin or your cloud provider's console (RDS, Cloud SQL, PlanetScale all expose them under "Connect" or "Connection details"). The user needs the privileges your workflows require - usually SELECT, INSERT, UPDATE, DELETE on the target schema, plus SHOW DATABASES if you want list-databases to work.

If the database sits inside a private network, allowlist the Spojit egress IPs in your security group or firewall rule, and enable TLS if your provider supports it. For PlanetScale-style services, generate a connection password under Branches -> Connect -> New password and use the host they provide.

Setting Up Your Connection

  1. Create a dedicated MySQL user (e.g. spojit_app) with the privileges your workflows need.
  2. Allowlist the Spojit egress IPs in your security group or DB firewall.
  3. In Spojit, go to Connections and click + Add Connection.
  4. Search for MySQL and select it.
  5. Enter host, port (default 3306), database name, username, and password. Enable TLS if your provider requires it.
  6. Name the connection (e.g. MySQL - Reporting Replica) and click Save. Spojit runs a quick test query to verify the credentials.

Using in a Workflow

Add a Connector node, select your MySQL connection, and pick a mode:

  • Direct Mode - You name the tool and pass parameters. Use execute-query for joins or analytics SQL; use insert-rows / update-rows / delete-rows for simple single-table writes - they avoid SQL injection footguns by handling escaping for you.
  • Agent Mode - The agent calls describe-table first to understand the schema, then writes SQL against it. Useful for ad-hoc questions like "find the top 10 customers by spend last month."

Always pass user-supplied values as parameters in execute-query, never by string concatenation, to avoid SQL injection.

Tips

  • Use a read replica for heavy reads. Point Spojit at a replica for reporting workflows and at the primary only when you need to write.
  • Cap result size. Add LIMIT to execute-query - a runaway SELECT can pull millions of rows into memory and stall the workflow.
  • Batch inserts. insert-rows takes an array. Inserting 1000 rows in one call is dramatically faster than 1000 single-row calls.
  • Index the columns you filter on. UPDATE ... WHERE status = 'pending' without an index on status locks more rows than you expect.
  • Cache describe-table results. If the schema is stable, fetch once and reuse across the workflow instead of describing on every step.

Common Pitfalls

  • Timezone confusion. DATETIME columns have no timezone; TIMESTAMP is stored as UTC but rendered in the session timezone. Always set the session TZ explicitly in execute-query for predictable date math.
  • Implicit type coercion. Comparing a string column to a number ("WHERE sku = 12345") silently fails to use the index. Quote string literals.
  • Connection pool exhaustion. Long-running queries inside a Loop node can saturate the DB connection pool. Use parallel nodes with a sensible concurrency cap.
  • SQL injection in dynamic queries. Never build SQL by concatenating user input. Use parameter binding in execute-query.
  • Soft-delete vs hard-delete. delete-rows issues DELETE. If your team's convention is to set a deleted_at column, use update-rows instead.

Common Use Cases

Related Articles

For technical API details and field specifications, see the MySQL connector documentation.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.