> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modulex.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MySQL Integration for AI Agents & Workflows

> MySQL database integration for executing SQL queries, managing tables, and performing CRUD operations. Uses the aiomysql driver.

{/* Self-hosted logo — build-time vendored from modulex.json / Iconify (see scripts/lib/logo.js). */}

<img src="https://mintcdn.com/modulexaillc/df8MOr-hXotYLTh5/logos/mysql.svg?fit=max&auto=format&n=df8MOr-hXotYLTh5&q=85&s=25e71058f96e534152d609a37ceeb887" alt="MySQL logo" width="72" height="72" data-path="logos/mysql.svg" />

## Overview

Add **MySQL** to any ModuleX agent or workflow. MySQL database integration via the `aiomysql` driver. Provides raw SQL execution + CRUD + stored procedures + introspection.

<Info>
  **Categories**: Databases · Database · Data Management · Storage · **Auth**: MySQL Database Credentials · **Actions**: 9
</Info>

## Authentication

### MySQL Database Credentials

Authenticate using MySQL connection credentials (host/port/user/password/database).

#### Required Credentials

| Field    | Description                                                       | Required | Format                           |                    |            |
| -------- | ----------------------------------------------------------------- | -------- | -------------------------------- | ------------------ | ---------- |
| Host     | MySQL server hostname or IP                                       | Yes      | `localhost or mysql.example.com` |                    |            |
| Port     | MySQL server port (defaults to 3306 if omitted)                   | No       | `3306`                           |                    |            |
| Username | MySQL username for authentication                                 | Yes      | `-`                              |                    |            |
| Password | MySQL password for authentication                                 | Yes      | `-`                              |                    |            |
| Database | The database name to connect to                                   | Yes      | `-`                              |                    |            |
| SSL Mode | SSL mode: 'disabled', 'verify' (default), or 'skip\_verification' | No       | \`verify                         | skip\_verification | disabled\` |

## Available Actions

<AccordionGroup>
  <Accordion title="execute_raw_query — Execute any SQL statement. Use '%s' for parameterized queries (DB-API style).">
    ### Parameters

    <ResponseField name="sql" type="string" required>
      The SQL to execute
    </ResponseField>

    <ResponseField name="values" type="array">
      Values for '%s' placeholders
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "row_count": {
          "default": 0,
          "title": "Row Count",
          "type": "integer"
        },
        "data": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Data",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "ExecuteRawQueryOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="create_row — INSERT a new row (returns affected_rows + last_insert_id)">
    ### Parameters

    <ResponseField name="table" type="string" required>
      The table name
    </ResponseField>

    <ResponseField name="data" type="object" required>
      Column-value pairs to insert
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "table": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Table"
        },
        "affected_rows": {
          "default": 0,
          "title": "Affected Rows",
          "type": "integer"
        },
        "last_insert_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Last Insert Id"
        },
        "columns": {
          "items": {
            "type": "string"
          },
          "title": "Columns",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "CreateRowOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="delete_row — DELETE rows matching a WHERE condition">
    ### Parameters

    <ResponseField name="table" type="string" required>
      The table name
    </ResponseField>

    <ResponseField name="condition" type="string" required>
      WHERE condition with '?' placeholders
    </ResponseField>

    <ResponseField name="values" type="array" required>
      Values matching the '?' placeholders
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "table": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Table"
        },
        "affected_rows": {
          "default": 0,
          "title": "Affected Rows",
          "type": "integer"
        }
      },
      "required": [
        "success"
      ],
      "title": "DeleteRowOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="update_row — UPDATE rows matching a WHERE condition">
    ### Parameters

    <ResponseField name="table" type="string" required>
      The table name
    </ResponseField>

    <ResponseField name="data" type="object" required>
      Column-value pairs to update
    </ResponseField>

    <ResponseField name="condition" type="string" required>
      WHERE condition with '?' placeholders
    </ResponseField>

    <ResponseField name="condition_values" type="array" required>
      Values matching the '?' placeholders
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "table": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Table"
        },
        "affected_rows": {
          "default": 0,
          "title": "Affected Rows",
          "type": "integer"
        },
        "updated_columns": {
          "items": {
            "type": "string"
          },
          "title": "Updated Columns",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "UpdateRowOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="find_row — SELECT * FROM table WHERE column <op> value">
    ### Parameters

    <ResponseField name="table" type="string" required>
      The table name
    </ResponseField>

    <ResponseField name="column" type="string" required>
      Column to filter by
    </ResponseField>

    <ResponseField name="operator" type="string">
      \=, >, >=, \<, !=, \<=, LIKE (Default: `=`)
    </ResponseField>

    <ResponseField name="value" type="string">
      Value to compare against
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "table": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Table"
        },
        "row_count": {
          "default": 0,
          "title": "Row Count",
          "type": "integer"
        },
        "data": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Data",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "FindRowOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="execute_query_with_condition — SELECT * FROM table WHERE <condition>">
    ### Parameters

    <ResponseField name="table" type="string" required>
      The table name
    </ResponseField>

    <ResponseField name="condition" type="string" required>
      WHERE condition with '?' placeholders
    </ResponseField>

    <ResponseField name="values" type="array" required>
      Values matching the '?' placeholders
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "table": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Table"
        },
        "row_count": {
          "default": 0,
          "title": "Row Count",
          "type": "integer"
        },
        "data": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Data",
          "type": "array"
        }
      },
      "required": [
        "success"
      ],
      "title": "ExecuteQueryWithConditionOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="execute_stored_procedure — CALL <stored_procedure>(...) with optional parameters">
    ### Parameters

    <ResponseField name="stored_procedure" type="string" required>
      Procedure name (may be qualified 'db.proc')
    </ResponseField>

    <ResponseField name="values" type="array">
      Procedure parameters
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "procedure": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Procedure"
        },
        "row_count": {
          "default": 0,
          "title": "Row Count",
          "type": "integer"
        },
        "data": {
          "anyOf": [
            {
              "items": {
                "additionalProperties": true,
                "type": "object"
              },
              "type": "array"
            },
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Data"
        }
      },
      "required": [
        "success"
      ],
      "title": "ExecuteStoredProcedureOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="list_tables — List all tables and views in the current database">
    ### Response

    ```json theme={null}
    {
      "$defs": {
        "TableEntry": {
          "additionalProperties": false,
          "properties": {
            "name": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Name"
            },
            "type": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "default": null,
              "title": "Type"
            }
          },
          "title": "TableEntry",
          "type": "object"
        }
      },
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "database": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Database"
        },
        "tables": {
          "items": {
            "$ref": "#/$defs/TableEntry"
          },
          "title": "Tables",
          "type": "array"
        },
        "count": {
          "default": 0,
          "title": "Count",
          "type": "integer"
        }
      },
      "required": [
        "success"
      ],
      "title": "ListTablesOutput",
      "type": "object"
    }
    ```
  </Accordion>

  <Accordion title="describe_table — Return column metadata for a table (SHOW COLUMNS)">
    ### Parameters

    <ResponseField name="table" type="string" required>
      The table name
    </ResponseField>

    ### Response

    ```json theme={null}
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "title": "Success",
          "type": "boolean"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Error"
        },
        "table": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Table"
        },
        "columns": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "title": "Columns",
          "type": "array"
        },
        "column_count": {
          "default": 0,
          "title": "Column Count",
          "type": "integer"
        }
      },
      "required": [
        "success"
      ],
      "title": "DescribeTableOutput",
      "type": "object"
    }
    ```
  </Accordion>
</AccordionGroup>

## Limits & Quotas

* 60s connection timeout.
* Connections are not pooled — opened per call, closed via the
  context manager.
* `find_row` operator allowlist: `=`, `>`, `>=`, `<`, `!=`, `<=`,
  `LIKE`.
* `aiomysql` is imported lazily so the manifest can be inspected
  without the driver installed.

## Related integrations

<CardGroup cols={3}>
  <Card title="PostgreSQL" href="/integrations/tools/postgresql" />

  <Card title="Snowflake" href="/integrations/tools/snowflake" />

  <Card title="Supabase" href="/integrations/tools/supabase" />
</CardGroup>

## Links

* [MySQL](https://www.mysql.com/)
