728x90
반응형
개발PC에서 pg_dump로 Postgresql DB DDL 또는 데이터를 백업하거나 psql 로 접속해서 테이블 속성을 보고 싶을 경우가 생길것이다.
하지만 Postgresql Command Line Tools 설치파일이 따로 존재하지 않는다.
Command Line Tools만 설치할 수 있는 방법은 Postgresql 서버 설치파일을 다운받고 컴포넌트 선택화면에서 Command Line Tools를 선택하면 된다.
설치환경
- Widnow 10 Pro
- Postgresql Command Line Tools - 14.1
- Postgresql Server - 13.1
https://www.enterprisedb.com/downloads/postgres-postgresql-downloads 접속하여 Windows x86-64, Postgresql 14.1 버전을 다운로드하자.
다운로드 받은 postgresql-14.1-1-windows-x64.exe 파일을 클릭하여 설치하자.
Command Line Tools 만 선택
Next
Finish를 클릭하면 설치가 완료된다.
C:\Program Files\PostgreSQL\14\bin\ 폴더를 확인해 보면 제일 많이 사용하는 psql.exe, pg_dump.exe 파일을 확인할 수 있을 것이다. (그 외 많은 툴이 설치되어 있는 것을 확인할 수 있다.)
윈도우 PATH를 등록하면 모든 폴더에서 명령어를 실행할 수 있다.
psql 명령어로 Postgresql DB를 접속해서 SQL 및 테이블속성(\d) 명령어를 실행하여 보자.
C:\Users\developer>psql -h 192.168.2.165 -p 5432 -U postgres -W
Password:
psql (14.1, server 13.1)
Type "help" for help.
postgres=# select current_database(), inet_server_addr(), inet_client_addr();
current_database | inet_server_addr | inet_client_addr
------------------+------------------+------------------
postgres | 192.168.2.165 | 192.168.0.17
(1 row)
postgres=# \d public.dummy_table
Table "public.dummy_table"
Column | Type | Collation | Nullable | Default
-----------+--------------------------------+-----------+----------+-------------------
no | integer | | not null |
title | character varying(300) | | not null |
content | text | | |
create_dt | timestamp(0) without time zone | | not null | CURRENT_TIMESTAMP
update_dt | timestamp(0) without time zone | | |
Indexes:
"dummy_table_pkey" PRIMARY KEY, btree (no)
postgres=#
728x90
반응형
'Database > Postgresql' 카테고리의 다른 글
PostgreSQL 15 출시 (0) | 2022.07.01 |
---|---|
[Postgresql/Greenplum] Order by Collate/NULLS 를 이용하여 데이터 정렬기준 변경하기 (0) | 2022.01.01 |
[Postgresql/Greenplum] 테이블명 길이 63Byte 제한 (0) | 2021.08.10 |
postgresql/greenplum uptime을 to_char 함수로 보기편하게 변경하기 (0) | 2021.04.04 |
[Postgresql] general_series 함수를 이용한 더미데이터 만드는 방법 (0) | 2021.02.26 |