# 5050 connect

> Open psql, mysql, redis-cli or mongosh against a database through a local tunnel.

Open psql, mysql, redis-cli or mongosh against a database through a local tunnel.

## Usage

```sh
5050 connect [SERVICE] [-- ARGS]
```

## Flags

| Flag | Meaning |
|---|---|
| `-P, --port PORT` | Local port for the tunnel |
| `--tunnel-only` | Print the local URL and keep the tunnel open instead of starting a client |

## Details

- The client must be installed locally. Arguments after `--` and standard input are passed through, so `pg_dump ... | 5050 connect Postgres -- psql` works.

## Examples

```sh
5050 connect Postgres
5050 connect Postgres -- -c 'select 1'
5050 connect Redis --tunnel-only
```

## Railway equivalent

`railway connect` works the same way through the [railway alias](https://5050cloud.com/docs/cli/railway-alias).

Every command also accepts the [global options](https://5050cloud.com/docs/cli/global-options).
