Back to Integrations
integrationGmail node
integrationMySQL node

Gmail and MySQL integration

Save yourself the work of writing custom integrations for Gmail and MySQL and use n8n instead. Build adaptable and scalable Communication, HITL, Development, and Data & Storage workflows that work with your technology stack. All within a building experience you will love.

How to connect Gmail and MySQL

  • Step 1: Create a new workflow
  • Step 2: Add and configure nodes
  • Step 3: Connect
  • Step 4: Customize and extend your integration
  • Step 5: Test and activate your workflow

Step 1: Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Gmail and MySQL integration: Create a new workflow and add the first step

Step 2: Add and configure Gmail and MySQL nodes

You can find Gmail and MySQL in the nodes panel. Drag them onto your workflow canvas, selecting their actions. Click each node, choose a credential, and authenticate to grant n8n access. Configure Gmail and MySQL nodes one by one: input data on the left, parameters in the middle, and output data on the right.

Gmail and MySQL integration: Add and configure Gmail and MySQL nodes

Step 3: Connect Gmail and MySQL

A connection establishes a link between Gmail and MySQL (or vice versa) to route data through the workflow. Data flows from the output of one node to the input of another. You can have single or multiple connections for each node.

Gmail and MySQL integration: Connect Gmail and MySQL

Step 4: Customize and extend your Gmail and MySQL integration

Use n8n's core nodes such as If, Split Out, Merge, and others to transform and manipulate data. Write custom JavaScript or Python in the Code node and run it as a step in your workflow. Connect Gmail and MySQL with any of n8n’s 1000+ integrations, and incorporate advanced AI logic into your workflows.

Gmail and MySQL integration: Customize and extend your Gmail and MySQL integration

Step 5: Test and activate your Gmail and MySQL workflow

Save and run the workflow to see if everything works as expected. Based on your configuration, data should flow from Gmail to MySQL or vice versa. Easily debug your workflow: you can check past executions to isolate and fix the mistake. Once you've tested everything, make sure to save your workflow and activate it.

Gmail and MySQL integration: Test and activate your Gmail and MySQL workflow

AI based data analysis, data visualization and data report with Ada.im

How it works:

This template demonstrates how to build a low-code, AI-powered data analysis workflow in n8n. It enables you to connect to various data sources (such as MySQL, Google Sheets, or local files), process and analyze structured data, and generate natural language insights and visualizations using external AI APIs.

Key Features:

Flexible data source selection (MySQL, Google Sheets, Excel/CSV, etc.)

AI-driven data analysis, interpretation, and visualization via HTTP Request nodes

Automated email delivery of analysis results (Gmail node)

Step-by-step sticky notes for credential setup and workflow customization

Step-by-step:
Apply for an API Key

You can easily create and manage your API Key in the ADA official website - API. To begin with, You need to register for an ADA account.

Once on the homepage, click the bottom left corner to access the API management dashboard.

Here, you can create new APIs and set the credit consumption limit for each API. A single account can create up to 10 APIs.

After successful creation, you can copy the API Key to set credentials. You can also view the credit consumption of each API and manage your APIs.

Set credentials

In HTTP nodes(DataAnalysis, DataInterpretation, and DataVisualization) select Authentication → Generic Credential Type

Choose Header Auth → Create new credential

Name the header Authorization, which must be exactly 'Authorization', and fill in the previously applied API key

Data Source:

The workflow starts by extracting structured data from your chosen source (e.g., database, spreadsheet, or file).

AI Skills:

Data is sent to external AI APIs for analysis, interpretation, and visualization, based on your configured queries.

Result Processing:

The AI-generated results are converted to HTML or Markdown as needed.

Output:

The final report or visualization is sent via email. You can easily adapt this step to other output channels.

API Keys Required:

Ada API Key: For AI data analysis

Gmail OAuth2: For sending emails (if using Gmail node)

(Optional) Data source credentials: For MySQL, Google Sheets, etc.

Nodes used in this workflow

Popular Gmail and MySQL workflows

AI based Data Analysis, Data Visualization and Data Report with Ada.im

How it works: This template demonstrates how to build a low-code, AI-powered data analysis workflow in n8n. It enables you to connect to various data sources (such as MySQL, Google Sheets, or local files), process and analyze structured data, and generate natural language insights and visualizations using external AI APIs. Key Features: Flexible data source selection (MySQL, Google Sheets, Excel/CSV, etc.) AI-driven data analysis, interpretation, and visualization via HTTP Request nodes Automated email delivery of analysis results (Gmail node) Step-by-step sticky notes for credential setup and workflow customization Step-by-step: Apply for an API Key You can easily create and manage your API Key in the ADA official website - API. To begin with, You need to register for an ADA account. Once on the homepage, click the bottom left corner to access the API management dashboard. Here, you can create new APIs and set the credit consumption limit for each API. A single account can create up to 10 APIs. After successful creation, you can copy the API Key to set credentials. You can also view the credit consumption of each API and manage your APIs. Set credentials In HTTP nodes(DataAnalysis, DataInterpretation, and DataVisualization) select Authentication → Generic Credential Type Choose Header Auth → Create new credential Name the header Authorization, which must be exactly 'Authorization', and fill in the previously applied API key Data Source: The workflow starts by extracting structured data from your chosen source (e.g., database, spreadsheet, or file). AI Skills: Data is sent to external AI APIs for analysis, interpretation, and visualization, based on your configured queries. Result Processing: The AI-generated results are converted to HTML or Markdown as needed. Output: The final report or visualization is sent via email. You can easily adapt this step to other output channels. API Keys Required: Ada API Key: For AI data analysis Gmail OAuth2: For sending emails (if using Gmail node) (Optional) Data source credentials: For MySQL, Google Sheets, etc.

Route equipment requests to Procurement with manager approval via Gmail

This workflow streamlines how employees request equipment/items and how those requests reach the Procurement team. It validates the employee by enrollment number, detects whether a manager exists, and then either requests approval (if the requester has a manager) or routes the request directly to Procurement (if the requester is a manager). All messages are written in a professional tone using an LLM, and emails are sent via Gmail with a built-in approve/deny step for managers. Who’s it for HR/IT/Operations teams that handle equipment requests, need a lightweight approval flow, and want clean, professional emails without manual drafting. How it works Employee submits their enrollment number. Workflow fetches employee (and manager, if any). Employee describes the requested item(s). If a manager exists → an approval email (double opt-in) is sent to the manager. Approved → notify employee and forward a polished request to Procurement. Denied → notify employee. If the requester is a manager → skip approval and send directly to Procurement. End pages confirm the outcome. Requirements MySQL (or compatible DB) with an employees table (id, name, email, enrollment_number, manager). Gmail credentials (OAuth) in n8n. LLM provider (OpenAI or compatible) for message polishing. How to customize Replace the Procurement NoOp nodes with your email, helpdesk, or ERP integration. Adjust email copy and tone in the LLM prompt nodes. Add tracking IDs, SLA text, or CCs for auditing. Style the forms with your brand (CSS blocks provided).

Automatically Add Gmail Sender Contacts to MySQL Database

This workflow processes emails received in Gmail and adds the sender's name and email address to a MySQL database. Use Cases: A sales or marketing agency can use this to automatically save client contact info to a database to build a list of leads Companies can use this to automatically save contacts to a database in case of Gmail data loss / losing access to their Gmail account Companies can build mailing lists to automatically send promotions to all of the clients who have contacted them in a given time period Before using, you need to have: Gmail credential MySQL database credential A Table in the MySQL database to store your contacts The table should have a "name" column, which allows NULL values The table should have an "email" column, which should be UNIQUE How it works: The Gmail Trigger will listen for a new email every minute For each email, the code node will extract the name and email address of the sender. If there is no name, it will return null The MySQL node will insert the new contact into a table in your database If the contact email already exists in your database, the MySQL node will update the contact name How to use: Please set up the MySQL node by selecting the correct table to store contacts in Please choose your "email" column to match on Please choose your "name" column to store names Customizing this Workflow: You can customize this workflow to save more data to MySQL. Here are some examples: In the MySQL node, click "Add Value", and choose one of the fields from the Gmail node to save in your database column. You can try saving the following items: Subject line MessageID ThreadID Snippet Recipient Info

Store Gmail Email Details in MySQL Database

This workflow processes emails received in Gmail and saves detailed information about each email to a MySQL database. Before using, you need to have: Gmail credentials MySQL database credentials A table in your database with the following columns: messageId (Gmail message ID) threadId snippet sender_name (nullable) sender_email recipient_name (nullable) recipient_email subject (nullable) How it works: The Gmail Trigger listens for new emails (checked every minute). A Code Node extracts the following fields from each email: Sender's name and email Recipient's name and email The MySQL Node inserts the extracted data into your database. If an entry with the same sender email already exists, it updates the record with the new details. How to use: Make sure your database table has all required columns listed above. Select the appropriate table and configure the matching column (e.g., id) to avoid duplicates. Customizing this Workflow: You can further modify the workflow to store attachments, timestamps, labels, or any other Gmail metadata as needed.

Build your own Gmail and MySQL integration

Create custom Gmail and MySQL workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Gmail supported actions

Add Label
Delete
Get
Get Many
Mark as Read
Mark as Unread
Remove Label
Reply
Send
Send and Wait for Response
Create
Delete
Get
Get Many
Create
Delete
Get
Get Many
Add Label
Delete
Get
Get Many
Remove Label
Reply
Trash
Untrash

MySQL supported actions

Delete
Delete an entire table or rows in a table
Execute SQL
Execute an SQL query
Insert
Insert rows in a table
Insert or Update
Insert or update rows in a table
Select
Select rows from a table
Update
Update rows in a table

FAQs

  • Can Gmail connect with MySQL?

  • Can I use Gmail’s API with n8n?

  • Can I use MySQL’s API with n8n?

  • Is n8n secure for integrating Gmail and MySQL?

  • How to get started with Gmail and MySQL integration in n8n.io?

Need help setting up your Gmail and MySQL integration?

Discover our latest community's recommendations and join the discussions about Gmail and MySQL integration.
jake chard
Jan Koch
Mohammadali
Michael Zareno
Neal A Richardson Sr

Looking to integrate Gmail and MySQL in your company?

Over 3000 companies switch to n8n every single week

Why use n8n to integrate Gmail with MySQL

Build complex workflows, really fast

Build complex workflows, really fast

Handle branching, merging and iteration easily.
Pause your workflow to wait for external events.

Code when you need it, UI when you don't

Simple debugging

Your data is displayed alongside your settings, making edge cases easy to track down.

Use templates to get started fast

Use 1000+ workflow templates available from our core team and our community.

Reuse your work

Copy and paste, easily import and export workflows.

Implement complex processes faster with n8n

red iconyellow iconred iconyellow icon