Skip to content

Commit

Permalink
docs: upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
planetscale-actions-bot committed Sep 17, 2024
1 parent 50f73fd commit 4f20c27
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/reference/shell.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'PlanetScale CLI commands: shell'
subtitle: 'Use the PlanetScale CLI “shell” command to open a secure MySQL shell instance to your database from your terminal.'
date: '2022-08-01'
date: '2024-09-17'
meta:
title: 'CLI reference: shell'
---
Expand Down Expand Up @@ -80,3 +80,25 @@ DATABASE_NAME/BRANCH_NAME > exit;
```

Type `exit` to exit the shell.

### Import an existing .sql file using the `shell` command

**Command:**

The following example assumes you have already ran the `pscale shell` command and you have the shell open to run a MySQL command.

To import an existing `.sql` file you may have available you would want to use the MySQL `source` command and provide it the path to your file:

```bash
DATABASE_NAME/BRANCH_NAME > source <YOUR_DUMP_FILE>.sql;
```

**Output:**

Your file should be imported as expected.

{% callout type="note" %}
When importing `.sql` dump files there are a few caveats to be aware of as sometimes the `.sql` file may have everything wrapped in a `START TRANSACTION;` / `COMMIT;` transaction which will result in the import timing out if it takes more than 20 seconds to complete due to our 20 second transaction timeout limit so you will want to make sure those are removed prior to beginning an import of the file.

Additionally, if your current schema requires our [foreign key constraints](/docs/concepts/foreign-key-constraints) support you may need to ensure it has been enabled within your database Settings area first before proceeding with your import.
{% /callout %}

0 comments on commit 4f20c27

Please sign in to comment.