Postgres
Installing
brew install postgres
Starting and stopping
brew services stop postgresql
brew services start postgresql
First setup
♥ psql
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: database "han" does not exist
You will get this error if you just run psql
after installing postgres for the first time. You need to setup a root user.
createdb `whoami`
then
psql postgres
Role "postgres" does not exist
createuser -s postgres
- fixes role "postgres" does not exist
Shell commands
Login to the shell
psql postgres
List all users
\du
Create roles
CREATE ROLE han WITH LOGIN PASSWORD 'password';
ALTER ROLE han CREATEDB;
9028fcc4-5902-4c5a-a20e-984c1484fe9b
Created on: 12th October, 2022
Last updated: 12th October, 2022