Skip to main content

Getting started

Make sure to first set up your PlanetScale developer environment. Once you’ve installed the pscale CLI, you can interact with PlanetScale and manage your databases straight from the command line.

The keyspace command

This command allows you to view your keyspaces, create internal or external keyspaces, resize them, and view or update your Vitess VSchemas. This command is not available for Postgres databases. Usage:

Available sub-commands

* Flag is required

Sub-command flag descriptions

Available flags

Global flags

Examples

Create an external keyspace

Attach an existing MySQL database as an external keyspace on a production branch. To import its data into PlanetScale, create a MoveTables workflow with the external keyspace as the source. --source-database is the remote MySQL database name. The --username user must have the import user permissions, and your database must allow connections from PlanetScale’s IP addresses.
Check compatibility without creating the keyspace:
--dry-run reports connection failures, server setting and user grant errors, and schema lint errors. Connection, server setting, and grant errors stop the keyspace from being created. Table-level schema errors don’t: fix those tables or leave them out of the import with --exclude-tables.

Resize an external keyspace

Use the same resize command as an internal keyspace. Do not pass --additional-replicas.
You can also create and resize external keyspaces from the Clusters page in the dashboard.

Delete an external keyspace

Deleting an external keyspace disconnects PlanetScale from your external database and removes its stored credentials. If you imported from it, complete the MoveTables workflow first.

Update tablet throttler settings

Update shard rollout concurrency

Set the maximum number of shards updated concurrently during keyspace configuration rollouts:
--max-rollout accepts values from 1 to 32. If the API value is not set, pscale keyspace settings displays not set, and PlanetScale uses the default of 1.

Change keyspace parameters

List a keyspace’s VTTablet and MySQL parameters, then change them. Changes for both namespaces are submitted together and roll out to the keyspace:
A change is applying while it rolls out and completed once every shard has it. A keyspace can have one unfinished change per namespace at a time. To set parameters back to their defaults, pass --reset:

List read-only regions for a keyspace

Output includes each region’s slug, cluster size, and replica count. Use a region slug with pscale password create ... --read-only-region or pscale database dump ... --read-only-region.

Need help?

Get help from the PlanetScale Support team, or join our Discord community to see how others are using PlanetScale.