DB(데이타베이스)/PostgreSQL
MacOS PostgreSQL install
Tada.*+
2022. 12. 30. 00:16
728x90
mac package manager 'brew'를 이용하여 postgreSQL을 설치합니다.
> brew install postgresql
* brew 설치가 되어 있지 않다면, 아래 사이트 명령어를 참고하여 설치해 줍니다.
https://docs.brew.sh/Installation설치 후에는 /opt/homebrew/bin을 path 등록해준 후 사용해야 합니다.
* brew 삭제하기
> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
위 명령어 실행 후 /opt/homebrew를 삭제해줍니다.
db 생성을 해줍니다.
> initdb [생성할 경로]
postgresql service를 시작합니다.
> pg_ctl -D [생성한 경로] start && brew services start postgresql
설치 확인
> postgres -V
접속 및 현재 권한 확인
> psql postgres
# 접속된 상태
postgres=# \du
* linux에 설치할 경우에는 local 계정이 아닌, root로 설치를 하고, \du 권한을 확인해 보면 아래와 같을 것입니다.
이때는, 기본적으로 'postgres' 계정이 생성되어집니다.
계정 초기 비밀번호를 설정합니다.
postgres=# \password [계정]
728x90