Refer to README for useful links and troubleshooting.
brew install postgresql
- Go to the
postgres.conf
file located here/usr/local/var/postgres/
change #listen_addresses = 'localhost'`` to ``listen_addresses = '*'
- Go to the
pg_hba.conf
file also located in/usr/local/var/postgres/
and Inject these statements to the IPv4 section.
host all all 172.17.0.0/16 trust
host all all 10.0.0.0/8 trust
- We want to run this next command in another window. The goal is to see if our default port is broadcasting/listening generally from
port 5432
.
netstat -n -a -f inet | grep 5432
- We should see a result like such in the terminal:
tcp4 0 0 *.5432 *.* LISTEN
psql -h <host> -d <db-name> -U <username>
This should prompt your password
CREATE USER <username> WITH PASSWORD '<password>';
brew services start postgresql
: To start serverbrew services stop postgresq
: To stop server\l
: List all databases\du
: List all users\q
: Quit postgresqlcreate <user> with password 'PASSWD' superuser;
: Create superuser with a passwordcreate database <databaseName>
: Create databasedrop user <username>;
: Drop userdrop database <databaseName>;
: Drop databasepostgres -D /usr/local/var/postgres
: Check postgresql logs