The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
---
title = "Error: \"Connection refused\" when trying to connect to Supabase database"
github_url = "https://github.com/orgs/supabase/discussions/14929"
date_created = "2023-06-09T10:38:06+00:00"
topics = [ "database", "cli" ]
keywords = [ "connection", "fail2ban", "econnrefused" ]
database_id = "9d8b179c-ff4d-4072-b9e6-2d16e63b2aaa"
[api]
cli = [ "supabase-network-bans-get", "supabase-network-bans-remove" ]
[[errors]]
message = "connect ECONNREFUSED 1.2.3.4:5432"
[[errors]]
message = "psql: error: connection to server at \"db.xxxxxxxxxxxxxxxxxxxx.supabase.co\" (1.2.3.4), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections?"
---
If you're not able to connect to the Supabase database and see one of the errors below, this could be because there are banned IPs on your project caused by Fail2ban as it kicks in when attempting 2 wrong passwords in a row.
- `connect ECONNREFUSED 1.2.3.4:5432`
- `psql: error: connection to server at "db.xxxxxxxxxxxxxxxxxxxx.supabase.co" (1.2.3.4), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?`
- `Circuit breaker open: Unable to establish connection to upstream database`
These bans clear after 30 minutes, but you can unban the IPs using the Supabase CLI. See [Local Development & CLI](/docs/guides/local-development)
## Unban IPs using the Dashboard
Go to [Database Settings](/dashboard/project/_/database/settings#banned-ips) and click **Unban IP**.
## Unban IPs using the CLI
How to list the banned IPs:
```
% supabase network-bans get --project-ref <project_reference_id> --experimental
```
How to unban the IPs:
```
% supabase network-bans remove --db-unban-ip <ip_address> --project-ref <project_reference_id> --experimental
```