tomcam/postgres

Test guide on macOS / Linux

Opened this issue · 1 comments

Hi there, thanks for this cool resource!

Some connection commands (eg. the Opening a connection locally command) do not work properly on macOS - the currently logged-in system user is used to log in (at least with Homebrew):

$ psql -U postgres
psql: error: could not connect to server: FATAL:  role "postgres" does not exist

Unfortunately, the command is different on the default installation of PostgreSQL on macOS:

$ psql postgres
psql (12.4)
Type "help" for help.

postgres=#

Linux has a third way (!!) of logging in, the last time I checked:

sudo -u postgres psql

References:

As a note for using postgres docker image:

You can follow this guide:
https://towardsdatascience.com/local-development-set-up-of-postgresql-with-docker-c022632f13ea

in regard to using psql

Exec Bash in Container
docker exec -it dev-postgres bash

Start psql
su postgres (sudo doesnt work (command not found))
psql

p.s.: thanks for this quick guide @tomcam