App overview screenshotSQL and Database Guides
PostgresMySQLSQLite
Try our free SQL Client
Tools
Connecting to Postgres
Connecting to Drivers
Installing Postgres
Setting up Postgres
Postgres   >   
Setting up Postgres   >   
Postgres on Railway

How To Setup PostgreSQL on Railway

PostgreSQL is one of the most popular database systems available today. In this guide, we’ll walk you through how to set up and connect to Postgres from the popular database hosting infrastructure Railway.

Creating a new Project with PostgreSQL on Railway

Log in to your Railway account and click ‘Create New Project’ on the main dashboard page. Select ‘Provision PostgreSQL’ to create your Postgres container.

Railway Provision PostgreSQL gif

Adding PostgreSQL to an Existing Railway Project

You can also add a Postgres container to an existing Railway project. On your project’s main page, click ‘Add Plugin’ and select ‘Add PostgreSQL Plugin’

Railway add Plugin

Connecting to your Railway PostgreSQL Database

Select ‘PostgreSQL’ from the left sidebar under ‘Environment,’ and navigate to the ‘Connect’ tab. Here, you’ll find all of the information you need to connect.

Railway postgres connection details

Click ‘show’ to reveal your Postgres password. You can interpret your credentials from the PSQL command like this:

PGPASSWORD=<password> psql -h <host> -U <user> -p <port> -d <database>

or from the connection URL like this:

postgresql:<user>:<password>@<host>:<port>/<database>

Then you can easily paste the connection URL into your SQL client like this:

Arctype Railway Postgres connection credentials

Or, enter these credentials into your SQL client to connect:

Arctype Railway Postgres connection credentials

Get help on databases and SQL. Join our Discord community.