Prisma needs a connection URL to be able to connect to your database, e.g. when sending queries with Prisma Client or when changing the database schema with Prisma Migrate.

The connection URL is provided via the url field of a datasource block in your Prisma schema. It generally consists of the following components (except for SQLite):

  • User: The name of your database user
  • Password: The password for your database user
  • Host: The IP or domain name of the machine where your database server is running
  • Port: The port on which your database server is running
  • Database name: The name of the database you want to use

Make sure you have this information at hand when getting started with Prisma. If you don't have a database server running yet, you can either use a local SQLite database file (see the Quickstart) or setup a free PostgreSQL database on Heroku.


Here are examples for the connection URLs of the databases Prisma supports:


datasource db {
provider = "postgresql"
url = "postgresql://janedoe:mypassword@localhost:5432/mydb"


datasource db {
provider = "mysql"
url = "mysql://janedoe:mypassword@localhost:3306/mydb"


datasource db {
provider = "sqlite"
url = "file:./dev.db"

Note that you can also provide the connection URL as an environment variable like so:

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")

You can then either set the environment variable in your terminal or by providing a dotenv file called .env. This will automatically be picked up by the Prisma CLI.




The format of the connection URL depends on the database connector you're using. Prisma generally supports the standard formats for each database. You can find out more about the connection URL of your database on the dedicated docs page:

Edit this page on GitHub