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

# MySQL

> Execute queries, manage tables, and perform CRUD operations on MySQL databases.

The MySQL connector lets your workflows interact with any MySQL-compatible database, including Amazon RDS, Google Cloud SQL, PlanetScale, and self-hosted instances.

> [!NOTE]
>
> This connector requires a **connection** with valid credentials before it can be used in a workflow. See [Managing Connections](https://docs.condotta.ai/platform/connections.md) for setup instructions.

## Connection setup

**1. Gather your MySQL credentials**

You'll need the following:

* **Host** (e.g., `localhost`, `db.example.com`, or an RDS endpoint)
* **Port** (default: `3306`)
* **Username** (e.g., `root` or a dedicated application user)
* **Password**
* **Database** (optional): the default database to connect to

**2. Add the connection in Condotta**

Go to **Connections** in Condotta, click **Add Connection**, select **MySQL**, and enter:

* **Host**: Your MySQL server hostname or IP
* **Port**: MySQL port number (default `3306`)
* **Username**: Database username
* **Password**: Database password
* **Database** (optional): Default database name
* **Use SSL** (optional): Enable for cloud-hosted databases

> [!TIP]
>
> **Cloud databases**: Most cloud providers require SSL connections. Enable the **Use SSL** toggle when connecting to AWS RDS, Google Cloud SQL, Azure Database for MySQL, or PlanetScale.

### Common MySQL settings

| Provider | Host example | Port | Notes |
| - | - | - | - |
| AWS RDS | `mydb.abc123.us-east-1.rds.amazonaws.com` | 3306 | Enable SSL, allow security group access |
| Google Cloud SQL | `10.0.0.3` (private IP) or via proxy | 3306 | Use Cloud SQL Auth Proxy for secure access |
| PlanetScale | `aws.connect.psdb.cloud` | 3306 | SSL required, use connection string from dashboard |
| Self-hosted | `localhost` or server IP | 3306 | Ensure firewall allows connections |

## Tools

> [accordion] execute-query: Execute a raw SQL query
>
> Execute any SQL statement including SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, and more. Supports parameterized queries with `?` placeholders.
>
> **query** `string` *required*
>
> SQL query to execute.
>
> **params** `unknown[]`
>
> Parameterized query values for `?` placeholders.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "query": "SELECT id, name, email FROM users WHERE status = ? LIMIT 10",
>   "params": ["active"]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "rows": [
>       { "id": 1, "name": "Alice", "email": "alice@example.com" },
>       { "id": 2, "name": "Bob", "email": "bob@example.com" }
>     ],
>     "fields": [
>       { "name": "id", "type": 3 },
>       { "name": "name", "type": 253 },
>       { "name": "email", "type": 253 }
>     ]
>   }
> }
> ```

> [accordion] list-databases: List all databases
>
> List all databases accessible with the current credentials.
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "databases": ["information_schema", "myapp", "analytics"]
>   }
> }
> ```

> [accordion] list-tables: List tables in a database
>
> **database** `string`
>
> Database name. Defaults to the connection's database.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "database": "myapp"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "tables": ["users", "orders", "products", "sessions"]
>   }
> }
> ```

> [accordion] describe-table: Get table schema
>
> Returns column definitions and the CREATE TABLE statement for a table.
>
> **table** `string` *required*
>
> Table name.
>
> **database** `string`
>
> Database name. Defaults to the connection's database.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "table": "users"
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "columns": [
>       { "Field": "id", "Type": "int", "Null": "NO", "Key": "PRI", "Default": null, "Extra": "auto_increment" },
>       { "Field": "name", "Type": "varchar(255)", "Null": "NO", "Key": "", "Default": null, "Extra": "" },
>       { "Field": "email", "Type": "varchar(255)", "Null": "NO", "Key": "UNI", "Default": null, "Extra": "" }
>     ],
>     "createStatement": "CREATE TABLE `users` (\n  `id` int NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) NOT NULL,\n  `email` varchar(255) NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `email` (`email`)\n) ENGINE=InnoDB"
>   }
> }
> ```

> [accordion] insert-rows: Insert rows into a table
>
> **table** `string` *required*
>
> Table name.
>
> **rows** `object[]` *required*
>
> Array of row objects to insert.
>
> **database** `string`
>
> Database name. Defaults to the connection's database.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "table": "users",
>   "rows": [
>     { "name": "Alice", "email": "alice@example.com" },
>     { "name": "Bob", "email": "bob@example.com" }
>   ]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "affectedRows": 2,
>     "insertId": 42
>   }
> }
> ```

> [accordion] update-rows: Update rows matching a condition
>
> **table** `string` *required*
>
> Table name.
>
> **set** `object` *required*
>
> Column values to update.
>
> **where** `string` *required*
>
> WHERE clause. Use `?` placeholders for parameterized values.
>
> **params** `unknown[]`
>
> Values for `?` placeholders in the WHERE clause.
>
> **database** `string`
>
> Database name. Defaults to the connection's database.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "table": "users",
>   "set": { "status": "active" },
>   "where": "last_login > ?",
>   "params": ["2024-01-01"]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "affectedRows": 15
>   }
> }
> ```

> [accordion] delete-rows: Delete rows matching a condition
>
> **table** `string` *required*
>
> Table name.
>
> **where** `string` *required*
>
> WHERE clause. Use `?` placeholders for parameterized values.
>
> **params** `unknown[]`
>
> Values for `?` placeholders in the WHERE clause.
>
> **database** `string`
>
> Database name. Defaults to the connection's database.
>
> **Example request:**
>
> ```json theme={null}
> {
>   "table": "sessions",
>   "where": "expires_at < ?",
>   "params": ["2024-01-01"]
> }
> ```
>
> **Example response:**
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "affectedRows": 128
>   }
> }
> ```

> [card] [Try this free for 14 days](https://preview.condotta.ai/signup)
>
> Start a 14-day trial on Band 1. At day 14, choose your band, or stop.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.