Getting Started
Make sure to first set up your PlanetScale developer environment. Once you’ve installed thepscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.
The database command
This command allows you to create, read, update, delete, dump, and restore databases, manage Postgres IP restrictions, and configure the Vitess database-level migration throttler.
Usage:
Available sub-commands
Service token automation: database
Legend: ✅ supported · 🚫 unavailable · 👤 interactive login only. All sub-commands require --org or PLANETSCALE_ORG.
* Flag is required
Sub-command flag descriptions
Some of the sub-commands have additional flags unique to the sub-command. This section covers what each of those does. See the above table for which context.Available flags
Global flags
The
--format flag does not apply to the database dump files created by the dump subcommand. However, you can control the output format using the --output-format flag, which supports SQL (default), JSON, and CSV formats. When using SQL format, dumps are compatible with mydumper.Examples
Create a new scaler_pro database
Command:
new-database was successfully created.
Create a Postgres database with storage size settings (Amazon EBS)
Use--min-storage and --max-storage to set the initial and maximum storage size in bytes when creating a Postgres database on Amazon Elastic Block Storage (EBS).
Command:
10737418240 bytes) and can scale up to 20 GiB (21474836480 bytes).
Create a dump of an existing branch:
This command is only available for Vitess databases. For Postgres databases, use the pg_dump command instead. Command:--output location above that will be used instead.
Export data in different formats:
You can specify the output format when dumping your Vitess database using the--output-format flag:
Export as JSON:
Dump specific columns from tables:
You can use the--columns flag to export only specific columns from your tables. This is useful when you need a partial export or want to exclude sensitive data:
Dump from a read-only region:
For Vitess databases with read-only regions, dump from a specific region instead of the primary:pscale keyspace read-only-regions <DATABASE_NAME> <BRANCH_NAME> <KEYSPACE_NAME>.
Update database settings
Only flags you pass are sent to the API. Boolean flags must be set explicitly (=true or =false). Flags marked Vitess-only are rejected for PostgreSQL databases.
Manage Postgres IP restrictions
Aliases:pscale database cidr and pscale database cidrs. Postgres only.
Database-level Vitess migration throttler
Sets the default throttler for future deploy requests on the database. This is not the per-deploy-request throttler and not the tablet/vtctld throttler. Vitess only. Use--ratio for one ratio across all eligible keyspaces, or --configuration for per-keyspace ratios (not both).
Restore a backup to an existing branch:
Command:pscale v0.218.0 or newer the --allow-different-destination flag is now available. If this flag is provided it will make the steps below about renaming the files unnecessary.
If you opt to import into a database with a different name you will have to make sure you rename the files from your backup beforehand.
For example, the files will be named something like this:
--overwrite-tables flag.

