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

# MySQL accounts

> Give people and agents access to a MySQL database without sharing its credentials.

A MySQL [account](https://infisical.com/docs/documentation/platform/pam/accounts/overview.md) stores the credentials for one MySQL database user. Members connect to the database in the browser or through the Infisical CLI, and Infisical records every query they run.

## Prerequisites

* The Admin [role](https://infisical.com/docs/documentation/platform/pam/concepts/access-control.md) on the [folder](https://infisical.com/docs/documentation/platform/pam/folders/overview.md) you'll add the account to
* A [gateway](https://infisical.com/docs/documentation/platform/gateways/overview.md) that can reach the database
* A MySQL [account template](https://infisical.com/docs/documentation/platform/pam/templates/overview.md)

## Create the account

**Step 1**

Go to **Privileged Access Management** > **Accounts** and select **Add Account**.

**Step 2**

Select the **Folder** and a MySQL **Account Template**, then select **Next**.

**Step 3**

Enter a **Name** and the connection details:

| Field | Description |
| - | - |
| **Host** | The database's hostname or IP address |
| **Port** | The database's port (defaults to `3306`) |
| **Database** | The database that sessions connect to |
| **SSL Enabled** | Whether to connect over TLS |
| **Reject Unauthorized** | Whether to reject a server certificate that can't be verified (shown when **SSL Enabled** is on) |
| **SSL Certificate** | The CA certificate that signed the server's certificate (shown when **SSL Enabled** is on) |

**Step 4**

Enter the **Username** and **Password** of the MySQL user, then select **Create**.

## Connect

To open a session, follow [Connect to an account](https://infisical.com/docs/documentation/platform/pam/accounts/connect.md).

> [tab] Browser
>
> The browser session has a table browser, where you can view, filter, edit, and export rows, and a SQL editor for running queries.

> [tab] CLI
>
> Start the local proxy:
>
> ```bash theme={"dark"}
> infisical pam access backend-team/orders-db
> ```
>
> The proxy keeps running in that terminal and prints its port. In a second terminal, connect your MySQL client to that port:
>
> ```bash theme={"dark"}
> mysql -h 127.0.0.1 -P <port> orders
> ```
>
> The proxy signs in for you, so the client doesn't need a password.

## Next steps

> [card] [MySQL credential rotation](https://infisical.com/docs/documentation/platform/pam/credential-rotation/mysql.md)
>
> Rotate the passwords of MySQL accounts.

> [card] [Sessions](https://infisical.com/docs/documentation/platform/pam/sessions/overview)
>
> Review and end the connections that people and agents make to your accounts.


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