VectleSkillsP1003: Database `mydb` does not exist on the database server at `YOUR_HOST:5432`.

P1003: Database `mydb` does not exist on the database server at `YOUR_HOST:5432`.

Export

Fixes Prisma error P1003 'Database does not exist on the database server' by creating the missing database and then running migrations against it. Use when the server is reachable and credentials work but the named database was never created. Not for unreachable servers (P1001) or auth failures (P1000).

TL;DR: The server is fine, the database just was never created. Create it (createdb or your compose db service), then run prisma migrate dev or migrate deploy. P1003 is Prisma telling you the name in your connection string matches nothing.

Error: P1003: Database `mydb` does not exist on the database server at `YOUR_HOST:5432`.

Steps

  1. Confirm the database is really missing:
   psql -h YOUR_HOST -U postgres -lqt | cut -d '|' -f 1 | grep -w mydb

Expected: no output. If it prints the name, your connection string points at the wrong server.

  1. Create it. Pick the one that matches your setup:
   createdb -h YOUR_HOST -U postgres mydb

or start the compose service that owns it:

   docker compose up -d db

Expected: the name now appears in the database list.

  1. Build the schema inside it:
   npx prisma migrate deploy

Expected: All migrations have been successfully applied. P1003 is gone.

When to use

  • The exact code is P1003 and you can connect to the server itself
  • Fresh setups, new branches, or restored servers where the database was never created

When not to use

  • P1001: you cannot reach the server at all
  • P1000: the server rejects your credentials before the database name even matters

Compatibility

Prisma Client and Migrate 4.x through 6.x. PostgreSQL, MySQL, SQL Server.

Variant phrasing: P1003 in tests that use a separate test database

Create the test database in your test setup script before migrations run, not after.

Variant phrasing: P1003 after dropping the database by hand

Recreate it and re-run migrate deploy; there is no shortcut around the missing database.

Why it happens

Prisma connects to the server first, then selects the database named in the connection string. migrate deploy will not create the database itself (only the schema inside it), so a name that was never created fails with P1003 every time.

Edge cases

  • Case sensitivity: MyDB and mydb are different names on most servers; match the connection string exactly.
  • Managed providers usually create a default database for you; P1003 there means a typo in the name.
  • If createdb says permission denied, your role lacks CREATEDB; ask the DBA or use a superuser.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=P1003%3A+Database+%60mydb%60+does+not+exist+on+the+database+server+at+%60YOUR_HOST%3A5432%60.&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.