I was trying to use Supabase's PostgreSQL database with Prisma for a project. Don't ask me why.
I kept getting this error while I was running npx prisma migrate dev --name init
to initialize my database schema:
npx prisma migrate dev --name init
Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "postgres.gunjffzpoblrok******"
Error: P1001: Can't reach database server at `postgres.gunjffzpoblrok******:5432`
Please make sure your database server is running at `postgres.gunjffzpoblrok******:5432`.
After a whole lot of brain-racking and literal trauma, I found the bloody answer.
Apparently,
Don't use special characters in your database password. They could cause issues.
If you're using Supabase, go to Project Settings...
Scroll down and click reset database password. Change the password (letters only) and update it in your .env file in your code.
Rerun the command, and you're good to go.
npx prisma migrate dev --name init
Happy hacking!
PS: Prisma Migration got stuck minutes later (facepalm). Solution here.
Top comments (0)