MySQL connector

Automate MySQL workflows and sync data across your entire stack

Connect MySQL to hundreds of apps and services to keep your data in sync, trigger workflows from database events, and cut out manual data operations.

What can you do with the MySQL connector?

MySQL sits at the center of countless production applications, but moving data in and out of it manually creates bottlenecks, errors, and engineering overhead. Integrating MySQL with tray.ai lets teams automate ETL pipelines, sync records across CRMs, data warehouses, and SaaS tools, and build workflows that react to database changes in real time. Whether you're managing customer data, application state, or business metrics, tray.ai makes it straightforward to connect MySQL to the rest of your stack without writing bespoke glue code.

Automate & integrate MySQL

Automating MySQL business process or integrating MySQL data is made easy with tray.ai

Use case

Real-Time CRM and MySQL Data Synchronization

Keep your MySQL database in sync with CRM platforms like Salesforce or HubSpot so customer records, deal stages, and contact updates flow automatically in both directions. Eliminate duplicate data entry and make sure your sales team always works from current information without waiting on engineering sprints.

Use case

MySQL to Data Warehouse ETL Pipelines

Automatically extract transformed data from MySQL tables and load it into data warehouses like Snowflake, BigQuery, or Redshift on a scheduled or event-driven basis. Maintain consistent schemas, handle incremental loads, and keep your analytics infrastructure fed without building custom ETL scripts.

Use case

Order and Inventory Management Automation

Connect MySQL-backed commerce or ERP systems to fulfillment platforms, shipping providers, and inventory tools so new orders, stock level changes, and shipment updates trigger downstream actions automatically. Reduce the lag between a database event and the business process it should kick off.

Use case

User Provisioning and Lifecycle Management

When new user records are inserted into MySQL or existing user status fields change, automatically provision or deprovision accounts in downstream tools like Slack, Google Workspace, or identity providers. Keep access control in sync with your application's source of truth.

Use case

Automated Reporting and Alerting

Schedule queries against MySQL tables to generate business reports, detect anomalies, and send alerts to Slack, email, or ticketing systems when thresholds are breached. Stakeholders get the data they need without writing SQL or waiting on a BI tool refresh cycle.

Use case

Lead Routing and Marketing Automation Sync

Capture form submissions or lead data written to MySQL and immediately push enriched records to marketing automation platforms like Marketo, Pardot, or Mailchimp. No lead falls through the cracks between your application database and your marketing stack.

Use case

AI Agent Data Retrieval and Write-Back

Power AI agents built on tray.ai with live MySQL data by letting them query records, look up context, and write structured outputs back to the database. Your agents get a reliable, queryable memory layer that persists across sessions and connects to real business workflows.

Build MySQL Agents

Give agents secure and governed access to MySQL through Agent Builder and Agent Gateway for MCP.

Data Source

Query Database Records

Execute SELECT queries to pull records from any MySQL table — customer data, orders, products, or whatever structured information lives in your database.

Data Source

Fetch Aggregated Metrics

Run aggregate queries (COUNT, SUM, AVG, etc.) to pull business metrics like total revenue, user counts, or inventory levels, giving the agent real-time operational context.

Data Source

Look Up Relational Data

Execute JOIN queries across multiple tables to retrieve related records, like combining customer profiles with their order history or support tickets for fuller context.

Data Source

Retrieve Schema Information

Inspect table structures, column definitions, and relationships so the agent knows what data is available and can construct accurate queries on the fly.

Agent Tool

Insert New Records

Write new rows into MySQL tables, letting the agent persist data like new leads, form submissions, event logs, or user-generated content directly to the database.

Agent Tool

Update Existing Records

Modify field values on existing rows based on conditions. Useful for keeping records current — updating an order status or correcting customer information, for example.

Agent Tool

Delete Records

Remove rows from tables based on specified criteria, letting the agent handle data cleanup, honor deletion requests, or clear out obsolete entries.

Agent Tool

Execute Stored Procedures

Invoke stored procedures in MySQL to trigger complex, multi-step database operations or business logic without the agent having to construct those queries from scratch.

Agent Tool

Bulk Insert Data

Insert multiple records in a single operation so the agent can sync large batches of data from external sources like CSV uploads or API responses into MySQL without making a separate call for each row.

Agent Tool

Run Custom SQL Statements

Execute arbitrary SQL for advanced use cases like DDL changes, conditional upserts, or complex transactions that go beyond simple CRUD operations.

Data Source

Monitor Table Changes

Poll specific tables or use timestamp-based queries to detect new or recently modified records, so the agent can kick off downstream workflows when data changes.

Get started with our MySQL connector today

If you would like to get started with the tray.ai MySQL connector today then speak to one of our team.

MySQL Challenges

What challenges are there when working with MySQL and how will using Tray.ai help?

Challenge

Handling Large Result Sets Without Timeouts

Querying MySQL tables with millions of rows inside an integration workflow can cause memory exhaustion, query timeouts, and unreliable pipeline behavior, especially when pulling data for bulk sync operations.

How Tray.ai Can Help:

tray.ai supports pagination and cursor-based iteration over MySQL query results, so workflows can process large datasets in configurable batches without hitting timeout thresholds or loading entire result sets into memory at once.

Challenge

Keeping Schema Changes from Breaking Pipelines

MySQL table schemas evolve as developers add, rename, or remove columns. Hard-coded field mappings break silently when the underlying schema changes, causing data loss or workflow failures that are hard to catch.

How Tray.ai Can Help:

tray.ai workflows can be built with flexible JSON-based field mapping and error handling branches that catch unexpected schema mismatches, log them, and alert engineering teams before data loss occurs. Centralized workflow management makes schema updates straightforward to propagate.

Challenge

Secure Credential and Network Access Management

Production MySQL instances are typically locked behind VPCs, private subnets, or firewall rules, making it hard to grant external integration platforms access without exposing the database to the public internet.

How Tray.ai Can Help:

tray.ai supports encrypted connections to MySQL including SSL/TLS, and credentials are stored in a dedicated secrets vault with role-based access control. For network-isolated databases, tray.ai can connect through whitelisted IPs or private tunnels to maintain your security posture.

Challenge

Avoiding Duplicate Records During Bi-Directional Sync

When syncing data between MySQL and external systems in both directions, it's easy to create infinite update loops or duplicate records if the integration doesn't correctly identify the origin of a change and avoid re-syncing records it just wrote.

How Tray.ai Can Help:

tray.ai workflows support conditional logic and sync-state tracking that identify whether a record was last modified by the integration itself or by an external actor, preventing echo loops and making sure deduplication keys are consistently applied during upsert operations.

Challenge

Orchestrating Multi-Step Transactions Reliably

Many business processes require writing to MySQL as part of a multi-step workflow that also calls external APIs. If a downstream step fails after MySQL has already been written to, the database can end up in an inconsistent state with no automatic rollback.

How Tray.ai Can Help:

tray.ai provides error handling, retry logic, and compensating transaction patterns that let workflows detect failures at any step and execute cleanup actions, such as updating a MySQL status field or triggering an alert, to maintain data consistency without requiring full database transactions across API boundaries.

Talk to our team to learn how to connect MySQL with your stack

Find the tray.ai connector with one of the 700+ other connectors in the tray.ai connector library to integrate your stack.

Integrate MySQL With Your Stack

The Tray.ai connector library can help you integrate MySQL with the rest of your stack. See what Tray.ai can help you integrate MySQL with.

Start using our pre-built MySQL templates today

Start from scratch or use one of our pre-built MySQL templates to quickly solve your most common use cases.

MySQL Templates

Find pre-built MySQL solutions for common use cases

Browse all templates

Template

Sync New MySQL Records to Salesforce Contacts

Automatically creates or updates a Salesforce Contact whenever a new row is inserted into a specified MySQL table, mapping database columns to CRM fields with transformation logic.

Steps:

  • Poll MySQL on a schedule or listen for insert events on the target table
  • Transform and map MySQL column values to Salesforce Contact fields
  • Upsert the Contact in Salesforce using email as the deduplication key

Connectors Used: MySQL, Salesforce

Template

MySQL to Snowflake Incremental Data Load

Extracts rows from MySQL added or modified since the last run using a watermark timestamp and loads them into a corresponding Snowflake table for analytics consumption.

Steps:

  • Read the last successful watermark timestamp from a tray.ai state store or control table
  • Query MySQL for rows where updated_at is greater than the watermark
  • Batch insert or merge the extracted rows into the target Snowflake table and update the watermark

Connectors Used: MySQL, Snowflake

Template

New MySQL Order Triggers Fulfillment and Slack Notification

Detects new order records in MySQL, submits the order to a fulfillment API, and posts a summary message to a Slack channel for real-time operations visibility.

Steps:

  • Poll MySQL orders table for rows with status equal to 'pending' and created_at within the last interval
  • POST order details to the fulfillment provider's REST API and capture the tracking reference
  • Update the MySQL order row with the tracking reference and post a confirmation to the Slack ops channel

Connectors Used: MySQL, Slack, HTTP Client

Template

Scheduled MySQL Report Delivered to Email

Runs a parameterized SQL query against MySQL on a weekly schedule, formats the results as an HTML table, and delivers the report to a distribution list via email.

Steps:

  • Trigger the workflow on a weekly cron schedule
  • Execute the reporting SQL query against MySQL and retrieve the result set
  • Format results into an HTML email body and send via SendGrid to the configured recipients

Connectors Used: MySQL, SendGrid

Template

HubSpot Contact to MySQL Lead Sync

When a new contact is created or a contact property is updated in HubSpot, the corresponding record in a MySQL leads table is upserted to keep both systems consistent.

Steps:

  • Trigger on HubSpot contact created or property change webhook event
  • Map HubSpot contact properties to the MySQL leads table schema
  • Execute an INSERT ... ON DUPLICATE KEY UPDATE statement in MySQL using the HubSpot contact ID as the key

Connectors Used: HubSpot, MySQL

Template

AI Agent Customer Lookup with MySQL Write-Back

Lets a tray.ai AI agent query MySQL for customer account details during a conversation, take an action, and write the outcome back to the database for record-keeping.

Steps:

  • Agent receives a customer inquiry via Slack and extracts the account identifier
  • Agent queries MySQL for the customer record and passes context to the OpenAI model for reasoning
  • Agent writes the resolution summary and timestamp back to a MySQL interactions table

Connectors Used: MySQL, OpenAI, Slack