설치
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads
Download PostgreSQL
PostgreSQL Database Download
www.enterprisedb.com
저는 Windows 사용자로 최신버전인 15.1 version을 설치했습니다.
설치 하다보면 중간에
비밀번호를 설정하라고 합니다.
추후에 DB에 접속할 때 비밀번호이니 까먹지 말고 잘 기억해 둡시다!
GUI도 활용하실 분은 pgAdmin 도 함께 설치 해주시면 됩니다.
stack builder는 처음에는 활용도가 낮으니 패스 해도 될것 같습니다.
실행
참고: https://www.postgresqltutorial.com/postgresql-getting-started/connect-to-postgresql-database/
Connect to PostgreSQL Database
Summary: in this tutorial, you will learn how to connect to the PostgreSQL Database Server via an interactive terminal program called psql and via the pgAdmin application. When you installed the PostgreSQL database server, the PostgreSQL installer also ins
www.postgresqltutorial.com
SQL Shell 실행
실행하니 위와 같이 나옵니다.
tutorial guide를 보면 빈값으로 엔터를하면 [] 안에 있는 값을 default로 해서 생성된다고 합니다.
설치시에 설정했던 비밀번호 까지 잘 입력하고 나면 위와 같이 DB에 접속 완료.
test로 version을 확인해봅시다!
$ SELECT version();
대문자 SELECT는 소문자로 써도 무방합니다.
GUI: pgAdmin4
gui 프로그램인 pgAdmin4를 이용해서 DB에 접속도 해봅시다.
실행후 맨 위 탭에서 Object > Register > Server ... 를 클릭하거나
Quick Links의 Add New Server를 클릭
General 탭에서 이름 입력해주시고~
Connection 탭에서 설치시 설정했던 password와 함께 위와 같이 입력하면 됩니다.
위와 같이 코끼리 아이콘이 달린 PostgreSQL 이 생성되었습니다!
CLI에서 했던 것처럼 version 확인을 해봅시다.
PostgreSQL > Databases > postgres 까지 선택하고
Tools > Query Tool 클릭 후 아래와 같이 쿼리문 입력하고 실행!
잘됩니다.
다음은 python에서 PostgreSQL에 연결하는 법을 익혀봅시다
'Database > PostgreSQL' 카테고리의 다른 글
PostgreSQL: query 기록하고 보기 - log파일로 보기 # /var/log/postgresql (0) | 2024.01.09 |
---|---|
PostgreSQL: query 기록하고 보기 - table(view)로 보기 # ORM # raw query # extension # pg_stat_statements (0) | 2024.01.09 |
DB Table 모두 지우고 리셋 # schema (0) | 2023.03.05 |
PostgreSQL install ~ begin with Django: Linux(Ubuntu) (0) | 2022.12.30 |
PostgreSQL Tutorial 사이트 (0) | 2022.12.04 |