일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 코로나바이러스
- 우한 코로나
- #항해플러스후기
- 우한
- 치앙마이
- 미중
- parasite
- 우한코로나바이러스
- 필리핀사망
- 진짜영웅
- 최성재
- red hearse
- sharonchoi
- 전염병
- 확진자수
- 조현병
- Bolton
- wuhan
- 어서와한국은처음이지
- 봉준호감독통역사
- everybody wants you
- 웨일즈
- 봉준호감독통역
- 신종코로나
- 코로나
- 창궐
- 정은경 본부장님
- 중국외교부
- 우한코로나
- 코로나19
- Today
- Total
오지's blog
postgres 설치 및 원격접속 설정 본문
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install postgresql postgresql-contrib
$ sudo -i -u postgres
$ psql
postgres-# create database airflow;
postgres-# create user admin with encrypted password 'admin';
postgres-# grant all privileges on database airflow to admin;
postgres-# \q
원격접속 허용 설정
루트계정으로 변경
1. postgresql.conf 설정파일 내용 변경
$ sudo vi /etc/postgresql/12/main/postgresql.conf
listen_addresses = 'localhost' # what IP address(es) to listen on;
에서
listen_addresses = '*' # what IP address(es) to listen on;
로 변경
2. pg_hba.conf설정파일 내용 변경
$ sudo vi /etc/postgresql/12/main/pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 md5
에서
# IPv4 local connections:
# host all all 127.0.0.1/32 md5
host all all 0.0.0.0/0 trust
로 변경
다시시작
$ sudo systemctl restart postgresql.service
참고.
sqlalchemy 라이브러리를 활용하여 postgresql 접속할수 있는 connection_string
postgresql+psycopg2://scott:tiger@localhost/mydatabase
https://docs.sqlalchemy.org/en/14/core/engines.html
Engine Configuration — SQLAlchemy 1.4 Documentation
Engine Configuration The Engine is the starting point for any SQLAlchemy application. It’s “home base” for the actual database and its DBAPI, delivered to the SQLAlchemy application through a connection pool and a Dialect, which describes how to talk
docs.sqlalchemy.org
'개발노트 > 데이터베이스' 카테고리의 다른 글
sqlalchemy.exc.OperationalError: (mariadb.OperationalError) Unknown server host '@ip_address' (0) | 2021.10.21 |
---|---|
MYSQL 접속시 public key retrieval is not allowed 에러 해결방법 (0) | 2021.10.21 |
MYSQL설치 후 설정 Ubuntu 20.04 기준 (0) | 2021.10.21 |
csv파일을 DB에 넣기(pandas이용) (0) | 2021.09.30 |
mysql관련 python 프로그램 에러 TypeError: not all arguments converted during string formatting (0) | 2021.03.15 |