반응형
목표 :
docker 컨테이너가 띄워져있다는 전제하에 postgresql에 접속을 해서 테이블을 조회 해보자
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
13e2af478713 postgres "docker-entrypoint.s…" 11 days ago Up 11 days 0.0.0.0:5432->5432/tcp, :::5432->5432/tcp rest
접속
docker exec -i -t rest bash
데이터베이스 보기
/l
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+------------+------------+-----------------------
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows)
테이블 보기
\dt
postgres-# \dt
List of relations
Schema | Name | Type | Owner
--------+---------------+-------+----------
public | account | table | postgres
public | account_roles | table | postgres
public | event | table | postgres
(3 rows)
account table 조회
postgres=# select * from account;
id | email | password
----+-------------------+----------------------------------------------------------------------
1 | sshaple@naver.com | {bcrypt}$2a$10$FvQR3sdpfTbS.Cw7LWvijeXbomulmvi6aw.65SuCwAf1XbZwxtG3G
(1 row)
반응형
'DataBase > Postgresql' 카테고리의 다른 글
[Windows용] postgreSQL (0) | 2013.09.02 |
---|---|
windows postgreSQL autocommit off 만들기 (0) | 2013.05.25 |
postgreSQL clob 처리 (2) | 2013.05.13 |
postgreSQL 외부접근, DB 공유 (2) | 2013.03.22 |
Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections (0) | 2013.01.16 |