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

# PlanetScale

> Connect your PlanetScale serverless MySQL database to VexiData.

## Prerequisites

* A [PlanetScale](https://planetscale.com) account with a database
* A [VexiData](https://vexidata.com) account

## Connect PlanetScale to VexiData

<Steps>
  <Step title="Create a password for VexiData">
    PlanetScale uses generated passwords for each connection. Create a dedicated one for VexiData:

    1. Log in to your [PlanetScale Dashboard](https://app.planetscale.com)
    2. Select the database you want to connect
    3. Click **Connect**
    4. Select the **Branch** you want to connect to (e.g., `main`)
    5. Click **Create password**
    6. Choose **General** as the connection type
    7. Copy the credentials shown:

    | Parameter    | Example                                |
    | ------------ | -------------------------------------- |
    | **Host**     | `aws.connect.psdb.cloud`               |
    | **Port**     | `3306`                                 |
    | **Database** | `my_database`                          |
    | **Username** | `abc123def456gh`                       |
    | **Password** | `pscale_pw_aBcDeFgHiJkLmNoPqRsTuVwXyZ` |

    <Note>
      The password is only shown once when created. Save it immediately. If you lose it, you'll need to create a new password.
    </Note>
  </Step>

  <Step title="Add the connection in VexiData">
    1. Go to [Data Sources](https://vexidata.com/data-sources) in VexiData
    2. Click **MySQL** to open the connection form
    3. Fill in the details:

    | Field            | Value                                                               |
    | ---------------- | ------------------------------------------------------------------- |
    | **Display Name** | A name to identify this connection (e.g., "PlanetScale Production") |
    | **Host**         | `aws.connect.psdb.cloud` (or your regional host)                    |
    | **Port**         | `3306`                                                              |
    | **Database**     | Your database name                                                  |
    | **Username**     | Your PlanetScale username                                           |
    | **Password**     | Your PlanetScale password (starts with `pscale_pw_`)                |
  </Step>

  <Step title="Test and save">
    Click **Test & Save Connection**. VexiData will verify it can reach your database. Once connected, your schema will be analyzed automatically.
  </Step>
</Steps>

## PlanetScale branches

PlanetScale supports database branching — each branch has its own connection credentials. When connecting to VexiData, make sure you select the correct branch (usually `main` for production data).

If you want to connect multiple branches (e.g., production and development), create a separate data source in VexiData for each one. You'll need to create a separate password for each branch in PlanetScale.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Connection timed out">
    * PlanetScale requires SSL for all connections. VexiData handles this automatically, but if you see timeout errors, verify the host and port are correct
    * Check that your PlanetScale database is not in a **sleeping** state (free-tier databases sleep after inactivity)
  </Accordion>

  <Accordion title="Authentication failed">
    * PlanetScale passwords start with `pscale_pw_`. Make sure you copied the full password including this prefix
    * Passwords are only shown once when created. If you've lost it, create a new password from the PlanetScale dashboard
    * Verify you're connecting to the correct branch — each branch has its own credentials
  </Accordion>

  <Accordion title="No tables visible after connecting">
    * Check that you selected the correct branch when creating the password. Your `main` branch has your production schema, while development branches may have different tables
    * Confirm the database name matches exactly what's shown in PlanetScale
  </Accordion>

  <Accordion title="Some MySQL features don't work as expected">
    * PlanetScale runs on Vitess, which has some differences from standard MySQL. Most standard queries work normally, but certain advanced features (like foreign key constraints in some configurations) may behave differently
  </Accordion>
</AccordionGroup>
