sincecutoff.com
← all changes

railway connect tunnels to private databases over SSH

Introduced 2026-06-11 · score 0.97

HOW TO USE IT

If the database service has no public proxy URL, run `railway connect <db>` to connect through an SSH tunnel. Use `--ssh` to force SSH, `--no-ssh` to require the public proxy, or `-P/--port <PORT>` to choose the local port.

railway connect <db>
railway connect <db> --ssh
railway connect <db> --no-ssh -P <PORT>

WHY THIS HELPS

Connect to a private Postgres, MySQL, Redis, or MongoDB service that has no public port.

BEFORE THIS CHANGE

Before the change, `railway connect` required a public TCP proxy and errored for a private-only database service.

REQUIREMENTS AND LIMITATIONS

  • Version: v5.11.0
  • <db> / [SERVICE_NAME]: Database service name; if omitted, prompts for a service when multiple exist.
  • --ssh: Use SSH instead of a public TCP proxy; automatic when no public proxy URL is available.
  • --no-ssh: Force the public TCP proxy path; conflicts with `--ssh`.
  • -P, --port <PORT>: Local port for the SSH tunnel; defaults to an ephemeral port.
  • Prerequisite: Install the appropriate local database client: `psql` for PostgreSQL, `mysql` for MySQL, `redis-cli` for Redis, or `mongosh` for MongoDB. The client is not required when using `--tunnel-only`.
  • Prerequisite: SSH connections require an SSH key registered with Railway; the CLI prompts to register a local key the first time you run `railway ssh`.
  • Supported databases: Postgres, MySQL, Redis, and MongoDB.
  • The local port is ephemeral by default unless pinned with `-P/--port`.
  • The SSH tunnel lives as long as the client.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card