본문 바로가기

BACK-END/DB

[DB][PostgreSQL] 초반에 찾는 명령어 (설치, 재시작, 계정, 생성, 조회)

PostgreSQL 설치

 

 

sudo apt-get update

sudo apt-get install postgresql postgresql-contrib

 

 

 

postgres 재시작

 

 

sudo service postgresql restart

 

 

 

postgres로 로그인하고, psql 실행

 

 

sudo -i -u postgres psql

 

 

 

나가기 

 

 

\q

 

 

 

계정 생성

 

 

CREATE ROLE 계정명 PASSWORD '비밀번호';

 

 

 

계정 삭제

 

 

DROP ROLE 계정명;

 

 

 

계정 목록 조회

 

 

\du

 

 

 

데이터베이스 생성

 

 

CREATE DATABASE 데이터베이스명 OWENR 계정이름 ;

 

 

 

데이터베이스 목록 조회

 

 

\ㅣ

 

 

 

권한 부여

 

 

 

ALTER ROLE "asunotest" WITH LOGIN;

 

 

https://positivemh.tistory.com/467

 

PostgreSQL 10 유저 superuser 권한, 롤 부여

OS환경 : Oracle Linux 7.6 (64bit) DB 환경 : PostgreSQL 10 방법 : PostgreSQL 10 유저 superuser 권한, 롤 부여 psql 접속 후 유저 권한(롤) 확인 1 2 3 4 5 6 7 8 9 $ psql psql (12.0) Type "help" for..

positivemh.tistory.com

 

 

 

참고하니까 괜찮았던 사이트들

 

https://zetawiki.com/wiki/%EB%B6%84%EB%A5%98:PostgreSQL

 

분류:PostgreSQL - 제타위키

다음 문자열 포함...

zetawiki.com

https://yeojin-dev.github.io/blog/postgresql-ubuntu/

 

Ubuntu 환경에서 PostgreSQL 설치 후 리모트 접속하기

YEOJIN-DEV

yeojin-dev.github.io