---
title: "ezgh databases connect"
description: "Open a local port to a database, from anywhere."
---

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

# ezgh databases connect

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh databases connect <database> [flags]
```

Open a local port to a database from anywhere you can run ezgh, with nothing in its VPC. Each connection to the port opens its own session to the database, so clients and pools that open several connections work. The engine's TLS runs from your client to the database, and the engine still checks its user and password. Sessions need databases.databases.connect; the database's allowed sources don't apply to them.

It prints what `ezgh databases connection` does, with the client command rewritten for the local port, and listens until interrupted (Ctrl-C). A connection ends when the database fails over, after 30 minutes without activity, or after 8 hours: ezgh says why and keeps listening.

Part of [`ezgh databases`](/cli/reference/databases).

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--address` | string | `127.0.0.1` | local address to listen on; anyone who can reach another address reaches the database through your access |
| `--port` | int |  | local port to listen on (default: the database's port) |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/databases-connect/index.mdx
