IndexNextPrisma Postgres
Import from MySQL
Import an existing MySQL database into Prisma Postgres, then use it with Prisma Next.
Move an existing MySQL database into Prisma Postgres, then connect Prisma Next to it.
Prerequisites
You need:
- the connection URL for the MySQL database you are importing from
- a Prisma Data Platform account
pgloader- Node.js 24 or newer
1. Create a Prisma Postgres database
Create a Prisma Postgres database from Console or with the CLI. Copy the direct connection string; you will use it for the import and for DATABASE_URL.
2. Create a pgloader config
Create config.load:
LOAD DATABASE
FROM mysql://USER:PASSWORD@HOST:PORT/DATABASE
INTO postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require
WITH quote identifiers,
include drop,
create tables,
create indexes,
reset sequences
ALTER SCHEMA 'DATABASE' RENAME TO 'public';3. Import into Prisma Postgres
Run pgloader:
pgloader config.load4. Add Prisma Next
From your app root, initialize Prisma Next:
bunx prisma-next initChoose PostgreSQL, set DATABASE_URL to the Prisma Postgres connection string, then infer and emit the contract:
bunx prisma-next contract infer --output ./prisma/contract.prisma
bunx prisma-next contract emit
bunx prisma-next db signNext steps
- Review table and column names in the inferred contract.
- Use the PostgreSQL existing-project guide for the first Prisma Next query.
- Use the full Prisma Postgres MySQL import guide for deeper migration details.