Reference:

https://www.youtube.com/watch?v=RebA5J-rlwg

 

npm prisma init

npx prisma init --datasource-provider mysql

 

✔ Your Prisma schema was created at prisma/schema.prisma
You can now open it in your favorite editor.

Next steps:
1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started


2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql, sqlite, sqlserver, mongodb or cockroachdb.


3. Run prisma db pull to turn your database schema into a Prisma schema.
4. Run prisma generate to generate the Prisma Client. You can then start querying your database.

 

 Use MySQL Workbench to set up a user and a database

set the following

.env

tsconfig.json

 

In schema.prisma

model User {
id Int @id @default(autoIncrement())

name String
}


> npx prisma migrate dev --name init

npm i @prisma/client

npx prisma generate

Look in  ./node_modules/@prisma/client  for code