# openrail 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
openrail 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 ... | openrail connect Postgres -- psql` works.

## Examples

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

## Railway equivalent

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

Every command also accepts the [global options](https://openrail.app/docs/cli/global-options).
