Skip to main content
To use a PlanetScale database with Vercel, there are a few prerequisites:

Get your connection string from PlanetScale

1
In your PlanetScale dashboard, click on the database you want to connect to.
2
Click “Connect”.
3
Create a new password. Make sure to copy the password, as you’ll only be shown it once.
4
Select the framework you’re using from the “Select your language or framework” section. This will give you the exact environment variable names you need for your selected framework. If your framework is not listed, choose “Other”.
PlanetScale dashboard connect modal {priority}
5
Keep this page open, as you’ll need to copy these to Vercel momentarily.
6
If you navigate away from the page, and can no longer access the password, create a new password by repeating steps 1-5.

Copy environment variables to Vercel

1
Go to your Vercel dashboard.
2
Click on your Vercel project.
3
Click “Settings”.
4
Click “Environment variables”.
5
Copy each value from your PlanetScale dashboard into a new environment variable in Vercel. Once you’re done with one, click “Add” and continue to the next, if applicable.
For example, if you’re using Prisma, your connection string will look similar to this:
DATABASE_URL='mysql://xxxxxxxxx:************@xxxxxxxxxx.us-east-3.psdb.cloud/my_database?sslaccept=strict'
In Vercel, you’ll set it as follows:
  • NAME = DATABASE_URL
  • VALUE = mysql://xxxxxxxxx:************@xxxxxxxxxx.us-east-3.psdb.cloud/my_database?sslaccept=strict
NoteThe credentials are blurred for the example, but when you paste them in, use the actual values.
Vercel dashboard - Environment variables

What’s next?

Learn more about how PlanetScale allows you to make non-blocking schema changes to your database tables without locking or causing downtime for production databases.

Need help?

Get help from the PlanetScale Support team, or join our GitHub discussion board to see how others are using PlanetScale.