# PlanetScale

How to back up and restore PlanetScale managed databases with SimpleBackups.

PlanetScale is a MySQL-compatible managed database platform built on Vitess. Backing it up through SimpleBackups lets you store portable copies in your own storage with custom retention schedules, independent of PlanetScale's internal backups. This guide covers both the automatic OAuth-based setup and the manual connection string approach.

## Automatic setup

In this section, you will connect your PlanetScale organization to SimpleBackups so that databases are discovered automatically via OAuth.

### Step 1: Get the organization name

1. Select the organization that contains the database you want to back up.
2. From the menu, select **Settings**.
3. Copy the **Organization Name**.

![PlanetScale organization overview screen](https://simplebackups.com/docs/docs-assets/media-helpkit-co/ed9ec9c2534607ce28b6.png)

![PlanetScale organization settings showing the Organization Name field](https://simplebackups.com/docs/docs-assets/media-helpkit-co/622d212d6b6f58a442f3.png)

### Step 2: Create a PlanetScale provider in SimpleBackups

1. Go to the [database backup page](https://my.simplebackups.com/backup/create?type=db) and click **Add** in the **Connect your DBaaS Provider** section.
2. Select **PlanetScale** from the **Provider** dropdown, enter a name for your PlanetScale account, paste the organization name, then click **Connect PlanetScale**.
3. You will be redirected to PlanetScale to log in and authorize access to your organization.
4. Select the organization and click **Authorize access**.

![SimpleBackups provider connection form for PlanetScale](https://simplebackups.com/docs/docs-assets/media-helpkit-co/23e14d474cd6eda60abe.png)

![PlanetScale OAuth authorization screen](https://simplebackups.com/docs/docs-assets/media-helpkit-co/4138ecba33104620183a.png)

![PlanetScale organization selection and authorize screen](https://simplebackups.com/docs/docs-assets/media-helpkit-co/3a340e68f69d039d4924.png)

## Manual setup

Use this approach if you prefer to supply connection credentials directly.

### Step 1: Open your PlanetScale database

Navigate to the **Databases** section in your PlanetScale dashboard.

![PlanetScale databases list screen](https://simplebackups.com/docs/docs-assets/media-helpkit-co/7c8f08c9cb98ab5e476a.png)

### Step 2: Configure IP filtering

1. Select the database you want to back up.
2. Go to **Settings**, then open the **Passwords** section.
3. Add the [SimpleBackups IP addresses](https://simplebackups.com/docs/help-tips-and-troubleshooting/connecting-a-server/simplebackups-ip-addresses-firewall) to the allowlist.

![PlanetScale passwords section with IP filtering configuration](https://simplebackups.com/docs/docs-assets/media-helpkit-co/531b6730ddeae8b8fd0f.png)

### Step 3: Copy your connection credentials

1. In the **Passwords** section, choose the password you want to connect through.
2. Copy the connection details (host, username).

![PlanetScale connection details screen showing host and username](https://simplebackups.com/docs/docs-assets/media-helpkit-co/64487f65a5aa6620e1de.png)

### Step 4: Set up a backup in SimpleBackups

Navigate to creating a new database backup and choose **Serverless**. You can connect using either manual form fill or automatic import:

**Manual connection**

Select the database **Type** and fill in the connection details, or click **Paste connection string** and enter the full connection URI.

![SimpleBackups database connection form with manual fields for PlanetScale](https://simplebackups.com/docs/docs-assets/media-helpkit-co/3daf6a740e74f987cc33.png)

**Automatic import via DBaaS provider**

1. Click **Connect your DBaaS Provider**.
2. Choose a **PlanetScale** provider.
3. Select the managed database you want to back up.
4. Click **Validate**.

![SimpleBackups DBaaS provider selection for PlanetScale](https://simplebackups.com/docs/docs-assets/media-helpkit-co/128cdd66449cac09464c.png)

### Step 5: Validate and activate

Click **Validate connection** to confirm that SimpleBackups can reach your database. Once validated, configure your schedule and activate the backup.

## Restoring a backup

To restore a backup, navigate to your backup page and open the **Logs** tab. Click the detail icon on the backup you want to restore from, then open the **Restore** tab. Generate a download link and copy it.

![PlanetScale backup logs tab](https://simplebackups.com/docs/docs-assets/media-helpkit-co/8e7536e0e707d234e9a5.png)

![PlanetScale backup detail view](https://simplebackups.com/docs/docs-assets/media-helpkit-co/15af67d55283e2292740.png)

![PlanetScale restore tab with download link](https://simplebackups.com/docs/docs-assets/media-helpkit-co/9959bfff3f230ce508e9.png)

Run the following command to download and decompress your backup (replace the URL with your signed download link):

```bash
wget -O - "<signed-download-url>" | gunzip -c > backup.sql
```

Then restore using `mysql`, replacing the placeholders with your credentials and database name:

```bash
mysql -u username -p database_name < backup.sql
```

**Tip:**
Use the latest version of `mysql` to avoid compatibility issues during restore.
