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

# MySQL & MariaDB

> Connect to MySQL 5.7+/8.0+ and MariaDB 10.x+ using the same MariaDB C connector driver

# MySQL & MariaDB Connections

TablePro supports MySQL 5.7+, MySQL 8.0+, and MariaDB 10.x+. Both databases share compatible protocols and use the same connection interface.

## Quick Setup

<Steps>
  <Step title="Create Connection">
    Click **New Connection**, select **MySQL** or **MariaDB**, enter host/port/username/password, and click **Create**
  </Step>

  <Step title="Test and Connect">
    Click **Test Connection** to verify
  </Step>
</Steps>

## Connection Settings

| Field        | Default                                     |
| ------------ | ------------------------------------------- |
| **Host**     | `localhost`                                 |
| **Port**     | `3306`                                      |
| **Username** | `root`                                      |
| **Database** | Leave empty to see all databases (optional) |

<Tip>
  Open URLs like `mysql://user:pass@host/db` from your browser to connect directly. See [Connection URL Reference](/databases/connection-urls) for details.
</Tip>

<Frame caption="MySQL connection form">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/mysql-connection-form.png" alt="MySQL connection form" />

  <img className="hidden dark:block" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct/images/mysql-connection-form-dark.png" alt="MySQL connection form" />
</Frame>

## Example Configurations

**Local**: host `localhost:3306`, user `root`
**Docker**: host `localhost:3306` (or mapped port), password from `MYSQL_ROOT_PASSWORD` env
**MAMP Pro**: host `localhost:8889`, user/pass `root:root`
**AWS RDS**: Use the endpoint hostname with a password or AWS IAM (see below)
**Remote**: Use [SSH tunneling](/databases/ssh-tunneling) for production servers

## AWS IAM Authentication

Connect to RDS or Aurora with IAM database authentication instead of a static password. Set **Authentication** in the connection form to one of the AWS IAM options:

* **AWS IAM (Access Key)**: enter an access key ID, secret access key, and optional session token.
* **AWS IAM (Profile)**: use a named profile from `~/.aws/credentials` or `~/.aws/config`. Profiles that use `credential_process` work too, so you can back the profile with SSO or assume-role via `aws configure export-credentials`.
* **AWS IAM (SSO)**: use a profile backed by IAM Identity Center. Run `aws sso login --profile <name>` first.

Set **Username** to a database user created with the AWS authentication plugin. The **AWS Region** is detected from the RDS hostname and can be overridden.

TablePro generates a fresh 15-minute login token on every connect and reconnect, so you never paste an expiring token. SSL is required for IAM and is turned on automatically.

<Warning>
  The database user must be created for IAM auth (`IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS'`). Connecting fails if the user only has a password.
</Warning>

## MySQL vs MariaDB

Same driver for both. MySQL 8.0 defaults to `caching_sha2_password` auth (vs MariaDB's `mysql_native_password`). Both support JSON, window functions, and CTEs.

## Features

Sidebar shows all accessible databases, tables, structure (columns, indexes, foreign keys), and DDL. Switch databases with **Cmd+K**. Full MySQL syntax support for queries:

```sql theme={null}
-- Select with JSON
SELECT id, JSON_EXTRACT(data, '$.name') as name
FROM users
WHERE JSON_CONTAINS(roles, '"admin"');

-- Window functions
SELECT
    department,
    employee,
    salary,
    RANK() OVER (PARTITION BY department ORDER BY salary DESC) as rank
FROM employees;

-- CTEs
WITH RECURSIVE category_tree AS (
    SELECT id, name, parent_id, 0 as level
    FROM categories WHERE parent_id IS NULL
    UNION ALL
    SELECT c.id, c.name, c.parent_id, ct.level + 1
    FROM categories c
    JOIN category_tree ct ON c.parent_id = ct.id
)
SELECT * FROM category_tree;
```

## Troubleshooting

**Connection refused**: Check MySQL is running (`brew services start mysql`), verify correct port/host, ensure `skip-networking` is not set.

**Access denied**: Verify credentials and user privileges with `SHOW GRANTS FOR 'user'@'host';`

**MySQL 8.0 auth issues**: Use native password with `ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';` or set `default_authentication_plugin=mysql_native_password` in `my.cnf`.

### SSL/TLS

New connections default to **Preferred**, which does a 2-pass connect: tries TLS first, falls back to plain only on SSL handshake errors (auth and network errors are not retried). Works for Cloud SQL, Azure MySQL, and local Docker. Use **Verify CA** with the provider's certificate for stricter validation. See [SSL/TLS](/features/ssl) for details.

## Performance Tips

Use `LIMIT` for large tables, enable pagination, create indexes, and use `EXPLAIN` for slow queries. Set session variables (timezone, encoding) via [Startup Commands](/databases/overview#startup-commands).
