Author: Tom Wragg
Postgres (PostgreSQL) is an open-source relational database management system.
Postgres supports multiple programming languages, replication, high availability, and offers extensive security measures.
Â
Sections
Â
Installation
Install postgresql
Install via homebrew
brew install postgresql
Â
Configuration
To start up the database, run the following:
/opt/homebrew/opt/postgresql@14/bin/postgres -D /opt/homebrew/var/postgresql@14
Â
Basic usage
Postgres provides the psql
CLI to interact with the Postgres database.
psql -V
Login to the default database and select your username:-
psql -d postgres
SELECT current_user;
Â
Advanced usage
Login with a specified username and database then list all databases and quit:-
psql -U wraggt -d postgres
List all databases:-
\l
Quit the session:-
\q