반응형
250x250
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- chart.js
- aws
- java bigdecimal
- Spring
- Python
- VPN
- codedeploy
- Kafka
- redis
- IntelliJ
- openlens
- Airflow
- Jenkins
- bootstrap
- 도커
- kubeflow
- Spring Error
- PostgreSQL
- docker
- COALESCE
- codepipeline
- codedeploy error
- chartjs
- SQL
- aws cicd
- Flux
- node
- codebuild
- JavaScript
- AWS CI/CD 구축하기
Archives
- Today
- Total
Small Asteroid Blog
서버에서 postgresql 접속 및 데이터베이스, 스키마, 테이블 조회 본문
728x90
psql로 접속 후 사용하는 명령어이다.
명령어
postgresql 접속 명령어
sudo -u postgres psql
postgresql 종료 명령어
\q
** crud 명령어 뒤에는 세미콜론을 붙여서 사용해야한다.
데이터베이스
전체 데이터베이스 조회
select datname from pg_database;
database 확인 (소문자 L)
\l
database 변경
\c 데이터베이스이름

테이블
전체 테이블 조회
#psql
\dt
\dt *.*
\c 데이터베이스이름
#sql
select tablename from pg_tables;
SELECT * FROM pg_catalog.pg_tables;
계정
사용자 확인
select * from pg_user;
계정삭제
drop role 계정;
계정 확인
\du
유저 생성 후 postgres유저와 같은 권한 부여 후 확인
psql
create user ankus;
alter user ankus with superuser;
alter user ankus with createdb;
\du
728x90
반응형
'백엔드 > DB' 카테고리의 다른 글
| postgresql 서비스 시작 및 상태 확인 (0) | 2021.06.30 |
|---|---|
| Postgresql에서 5432 port가 열려있냐는 문제(Ubuntu 기준) (0) | 2021.06.30 |
| postgresql - relation "hibernate_sequence" does not exist (0) | 2021.05.14 |
| Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted (0) | 2021.04.16 |
| NoSQL (0) | 2021.03.12 |