PostgreSQL
# Commends
Docker
connect local(mac) DB without docker
connect to a remote database
Access postgreSQL of Docker container
if run docker on localhost and use port 5432
Access postgreSQL docker
manual run & stop
The Homebrew package manager includes launchctl plists to start automatically. For more information run brew info postgres
.
Start manually:
pg_ctl -D /usr/local/var/postgres start
Stop manually:
pg_ctl -D /usr/local/var/postgres stop
Start automatically:
"To have launchd start postgresql now and restart at login:"
brew services start postgresql
if you install manually follow this
PostgreSQL
Mac
download BigSQL (ui based installer)
https://www.bigsql.org/oscg_download.jsp?file=packages/PostgreSQL-9.6.2-2-osx64-bigsql.dmg&user=
run pgDevOps after install
how to run?
exit
command line
\h
admin command line
\?
list roles
\du
create user
CREATE USER "local_test" WITH PASSWORD '123456'
change password
ALTER USER "user_name" WITH PASSWORD 'new_password';
create database
create database ror5_tutorial with owner = 'ror5';
Alter database
ALTER DATABASE name OWNER TO new_owner
Commands
List db
PSQL
select query
psql -U postgres \connect ror5_tutorial
list table
\dt
Error
Socket File “/var/pgsql_socket/.s.PGSQL.5432” Missing InMountain Lion (OS X Server)
=> solution
setting in .bash_profile
issue
Can't run psql command, keep getting the same error
int type change to UUID
up
down
References
Last updated
Was this helpful?