> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fly.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect With flyctl

<Warning>
  Important: We are not able to provide support or guidance for unmanaged Postgres. We now offer [Fly.io Managed Postgres](/mpg) , our fully-managed database service that handles all aspects of running production PostgreSQL databases.
</Warning>

To connect to your Postgres database from outside your Fly organization, you need a WireGuard connection. However, flyctl on your local machine can connect using [user-mode WireGuard](https://fly.io/blog/our-user-mode-wireguard-year/) magic, without you having to set up your own WireGuard tunnel.

For a `psql` shell, you can just use the [`fly postgres connect`](/flyctl/cmd/fly_postgres_connect) command:

```bash theme={null}
fly postgres connect -a <postgres-app-name>
```

You can also forward the server port to your local system with [`fly proxy`](/flyctl/cmd/fly_proxy):

```bash theme={null}
fly proxy 5432 -a <postgres-app-name>
```

Then connect to your Postgres server at localhost:5432. Using `psql` again, as a trivial example, it would look like this:

```bash theme={null}
psql postgres://postgres:<password>@localhost:5432
```

If you already have something else listening on port 5432, you can run this instead:

```bash theme={null}
fly proxy 15432:5432 -a <postgres-app-name>
```

Then connect to localhost:15432.

As with all your Fly apps, you can get a root console on your app's VM using [fly ssh](/flyctl/cmd/fly_ssh).
