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.
Log in to your Railway account and click ‘Create New Project’ on the main dashboard page. Select ‘Provision PostgreSQL’ to create your Postgres container.
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’
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.
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:
Or, enter these credentials into your SQL client to connect: