(DBConnection.ConnectionError) tcp connect (localhost:5432): network is unreachable - :enetunreach

This is my db config for dev

config :rest_api, RestApi.Repo,

username: “phoenix”,

password: “postgres”,

database: “rest_api_dev”,

hostname: “localhost”,

show_sensitive_data_on_connection_error: true,

pool_size: 10

It was working perfectly fine yesterday when i created and started learning elixir but today when i try to start the server with mix phs.server the server starts but getting this error with db connection

[error] Postgrex.Protocol (#PID<0.375.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): network is unreachable - :enetunreach

I am running phoenix in wsl windows newbie to phoenix so kindly help even if it is a small fix

Are you able to connect to your DB with some GUI tool or via command line with psql?

yeah i tried with wsl was able to connect

Might be the system Windows Firewall.

might be i think it started working on restarting but