PlanetScale Cheat Sheet

Last Updated: November 21, 2025

CLI Installation & Setup

brew install planetscale/tap/pscale
Install PlanetScale CLI (macOS)
scoop install pscale
Install PlanetScale CLI (Windows)
pscale auth login
Authenticate CLI with your account
pscale auth logout
Sign out of CLI
pscale region list
List available regions
pscale org list
List your organizations
pscale org switch <org>
Switch active organization

Database Management

pscale database create <database> --region us-east
Create new database in region
pscale database list
List all databases
pscale database show <database>
Show database details
pscale database delete <database>
Delete database permanently
pscale database dump <database> <branch>
Export database dump
pscale database restore-dump <database> <branch> --dir ./dump
Restore from dump

Branch Workflow

pscale branch list <database>
List all branches
pscale branch create <database> <branch>
Create new branch from main
pscale branch create <database> <new-branch> --from <source-branch>
Create branch from specific branch
pscale branch show <database> <branch>
Show branch details
pscale branch delete <database> <branch>
Delete development branch
pscale branch promote <database> <branch>
Promote branch to production
pscale branch safe-migrations enable <database> <branch>
Enable safe migrations on branch
pscale branch schema <database> <branch>
View branch schema
pscale branch diff <database> <branch>
Show schema differences from parent
Development branches allow direct DDL
Execute schema changes directly
Production branches require deploy requests
Schema changes via deployment flow

Schema Changes & Deploy Requests

pscale deploy-request create <database> <branch>
Create deploy request from branch
pscale deploy-request list <database>
List all deploy requests
pscale deploy-request show <database> <number>
Show deploy request details
pscale deploy-request diff <database> <number>
View schema changes in deploy request
pscale deploy-request deploy <database> <number>
Deploy approved changes to production
pscale deploy-request cancel <database> <number>
Cancel pending deploy request
pscale deploy-request review <database> <number>
Review deploy request
Non-blocking schema changes
PlanetScale performs online schema migrations
Automatic schema conflict detection
Prevents conflicting simultaneous changes
Schema revert capability
Roll back schema changes if needed

Shell & Connection

pscale shell <database> <branch>
Open MySQL shell to branch
pscale shell <database> <branch> --execute "SELECT * FROM users"
Execute SQL query via shell
pscale connect <database> <branch>
Create secure connection proxy
pscale connect <database> <branch> --port 3309
Connect on specific local port
mysql -h 127.0.0.1 -P 3306 -u root
Connect via standard MySQL client (after pscale connect)
pscale connect <database> <branch> --execute "SELECT VERSION()"
Run query via connection

Password & Credentials

pscale password create <database> <branch> <name>
Create database password
pscale password list <database> <branch>
List all passwords for branch
pscale password delete <database> <branch> <id>
Revoke database password
pscale password create --role reader
Create read-only password
pscale password create --role writer
Create read-write password
pscale password create --role admin
Create admin password (DDL access)
Passwords are shown only once
Save credentials immediately
Use service tokens for CI/CD
Create tokens for automated workflows

Connection Strings

mysql://user:pass@host/database?sslaccept=strict
General MySQL connection string format
DATABASE_URL="mysql://user:pass@aws.connect.psdb.cloud/db?ssl={"rejectUnauthorized":true}"
Node.js connection string
sslaccept=strict
Require SSL for connections (Go)
?ssl={"rejectUnauthorized":true}
SSL config for Node.js
Connection strings include region endpoint
Format: region.connect.psdb.cloud
Use environment variables for credentials
Never hardcode passwords

Backup & Restore

pscale backup list <database> <branch>
List automated backups
pscale backup show <database> <branch> <id>
Show backup details
pscale backup create <database> <branch>
Create manual backup
pscale backup restore <database> <branch> <id>
Restore from backup
Daily automatic backups (paid plans)
Backups retained for 30 days
Point-in-time recovery
Restore to any point in time (Enterprise)

Vitess Features

Built on Vitess
YouTube's MySQL scaling solution
Automatic sharding
Horizontal scaling as data grows
Online schema migrations
Zero-downtime DDL changes
Connection pooling
Built-in connection management
Query rewriting
Optimizes queries automatically
VTGate proxy layer
Routes queries to correct shards
Read replicas
Scale read operations
Automatic failover
High availability built-in

Insights & Monitoring

pscale database insights <database>
View database performance insights
Query Insights dashboard
Monitor slow queries and performance
Connection count monitoring
Track active connections
Storage usage metrics
Monitor database size growth
Rows read/written metrics
Track database activity
Query performance statistics
Identify optimization opportunities
Real-time alerts
Set up notifications for issues

Migration from Other Databases

mysqldump for data export
Export from existing MySQL database
pscale database restore-dump
Import dump into PlanetScale
Remove foreign key constraints
Vitess doesn't support foreign keys
Update AUTO_INCREMENT columns
Use BIGINT for auto-increment fields
Test application compatibility
Validate queries work with Vitess
Use development branch for testing
Test migration before production
Import Tool in dashboard
Web UI for importing databases

Best Practices

Use branches for schema changes
Test changes before production
Enable safe migrations on production
Prevent accidental direct DDL
Implement proper indexing
Critical for query performance
Use read-only passwords for analytics
Principle of least privilege
Monitor query insights regularly
Identify slow queries early
Avoid SELECT * queries
Only query needed columns
Use connection pooling in applications
Efficient connection management
Review deploy requests before merging
Check schema changes carefully
Leverage regional deployments
Deploy close to your users
Rotate passwords periodically
Good security hygiene

Pricing Tiers

Hobby tier: Free
5GB storage, 1 billion rows read/month
Scaler Pro: $29/month
10GB storage, 100 billion rows read
Scaler Pro Plus: $49/month
Enhanced features and support
Enterprise: Custom pricing
Unlimited scale, SLA, dedicated support
Pay-as-you-go billing
Based on storage and reads/writes
No charge for development branches
Only production branches count against limits
Pro Tip: Use the branching workflow like Git for your database! Create a development branch for schema changes, test thoroughly, then create a deploy request to merge into production. PlanetScale handles the migration safely without downtime. Always review schema diffs before deploying!
← Back to Databases & APIs | Browse all categories | View all cheat sheets