- Node.js >= 16
- Yarn
- MySQL running and reachable
yarn install
Create a .env
file at the project root with your database URL:
DATABASE_URL="mysql://root:root@127.0.0.1:3306/mydb"
Ensure the database exists:
mysql -u root -proot -e "CREATE DATABASE IF NOT EXISTS mydb;"
Connect to MySQL Shell:
\connect root@localhost:3306;
USE mydb;
SHOW TABLES;
SHOW DATABASES;
SELECT * FROM user;
yarn prisma migrate dev --name init
This applies the SQL in prisma/migrations/**/migration.sql
and regenerates the Prisma client.
yarn dev # uses nodemon
# or
yarn start # plain node
yarn prisma:migrate:dev # Apply migrations in dev mode
yarn prisma:migrate:deploy # Apply migrations in production
yarn prisma:generate # Generate Prisma client
yarn prisma:studio # Open Prisma Studio
yarn prisma:db:push # Push schema without migrations