PostgreSQL: Using the PostgreSQL psql CLI
This documentation is part of the Getting started guide. View the full guide here: How to get started with PostgreSQL.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use PostgreSQL cloud solution that provides a host of benefits, including:
- Unlimited connections and data transfers.
- PgAdmin web UI included.
- Many modules included like
PostGIS,TimescaleDBandPgVector.- Effortless updates with just a click.
- Optimal performance and robust security powered by a private and dedicated VM.
Save time and simplify your life: it only takes 5 minutes to try Stackhero's PostgreSQL cloud hosting solution!
You can manage PostgreSQL with its official psql CLI. It is available for installation on your computer, allowing you to manage your PostgreSQL service remotely. Alternatively, you can run it via Docker. This method is often preferred because it avoids installing psql directly on your computer and makes it easier to switch between versions.
To access psql using Docker, run the following command (make sure to replace 18 with the major version number of your PostgreSQL service):
docker run -v $(pwd):/mnt -it postgres:18-alpine /bin/bash
Then connect to your PostgreSQL service using:
cd /mnt
psql \
--host=<XXXXXX>.stackhero-network.com \
--username=admin \
--port=<PORT> \
--dbname=admin