Connect To Multiple Branches From The PlanetScale CLI

August - 2021

Run the planetscale cli multiple times to connect to different branches:

# Terminal 1
pscale connect your-database main
# Terminal 2
pscale connect your-database another-branch

The first connection will use port 3306 if it's available or another random port if it's not.

The second connection will use a random port either way.

When the connection is made, the port being used will be output. Fill it in like the following:

host: 127.0.0.1
port: (whatever port number shows up on the command line)
database: (your database name)
username: root
password: (leave blank)