返回
创建于
状态公开

prisma 连不上 wsl 中的 pg DATABASE_URL="postgresql://postgres:postgres@localhost:5432/blog?schema=public"

因为 localhost 被解析到 ipv6 了,但是只有 127.0.0.1 会被转发。

验证连接工具 你可以先不用 Prisma,直接在 Windows 命令行(CMD/PowerShell)试一下能不能连通:

替换为你的 WSL IP

bash
1Test-NetConnection -ComputerName 172.25.x.x -Port 5432

如果 TcpTestSucceeded 为 False,说明是防火墙或 Postgres 配置问题;如果为 True 但 Prisma 连不上,说明是连接字符串格式问题。