Database Connection Attempting to connect to the database
valentine387
FREEOP

5 hours ago

Hi, i am facing the challenge of getting my database to connected, it get stuck at attempting to connect to database and when it finish running i see the error message : connection terminated unexpectedly. please help me out

Screenshot 2026-06-16 at 16.46.12.png

Attachments

Solved$10 Bounty

Pinned Solution

At this point I'd recreate a new Postgres instance, and delete the old one (don't delete the volume).

Then, drag the old volume onto the new service to swap volumes, and redeploy.

10 Replies

Railway
BOT

5 hours ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway about 5 hours ago


Are there any errors in your database logs?


valentine387
FREEOP

5 hours ago

no errors


Try reloading the page, accessing the dashboard from a different device/network, or redeploying the database.


valentine387
FREEOP

5 hours ago

ok, i have just done both and i get this last log :

Screenshot 2026-06-16 at 17.05.59.png

Starting Container

Attachments


valentine387
FREEOP

5 hours ago

i redeployed, restarted and also used a different network to access the dashboard


valentine387

ok, i have just done both and i get this last log : ![Screenshot 2026-06-16 at 17.05.59.png](https://station-server.railway.com/attachments/att_01kv8fh3ecexxt90tteww8ft2t) Starting Container

Are you able to access your database via a DB client (eg, Datagrip) through the public URL?


valentine387
FREEOP

5 hours ago

No, I get "server closed the connection unexpectedly" when connecting via psql or DataGrip-style clients through the public proxy URL (DATABASE_PUBLIC_URL). I also can't connect via Railway's own in-browser Console (psql not found there) or via internal DATABASE_URL from inside my app's own Railway console (ECONNREFUSED). The Database tab in Railway's UI itself also shows "Connection terminated unexpectedly" when trying to connect via SSH.


The command psql wasn't a thing when you ran it in the console tab in the Postgres service?


valentine387
FREEOP

5 hours ago

Correct, when I open the Postgres service's Console tab and run psql $DATABASE_URL`, it returns: bash: psql: command not found

This happens even though I'm in the Postgres service's own console (not the app's). So I haven't been able to use psql from anywhere, not from the Postgres console, not from my local Mac terminal via the public proxy (which gives "connection terminated unexpectedly" / ECONNRESET instead), and not via railway connect Postgres from the CLI (same ECONNRESET).


At this point I'd recreate a new Postgres instance, and delete the old one (don't delete the volume).

Then, drag the old volume onto the new service to swap volumes, and redeploy.


Status changed to Solved passos about 3 hours ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...