백엔드/DB
[postgresql] dt did not find any relations
작은소행성
2021. 11. 15. 13:45
psql에서
database gtck 에 postgres 사용자로 접속했다.
sudo -u postgres psql
# \c [DBname] [Connection User]
\c gtck postgres
데이터 베이스에 접속 후 테이블 목록을 조회했는데 결과가 나오지 않았다.
다음 명령어로 현재 데이터베이스의 권한을 확인해보면 Access privileges 에 아무것도 없는것을 확인할 수 있다. (L 의 소문자)
\l
다음 명령어로 현재 테이블의 권한을 확인해보면 Access privileges 에 아무것도 없는것을 확인할 수 있다.
\dn+
Database 와 Schema 에 권한
Grant CONNECT to the database
# GRANT CONNECT ON DATABASE database_name TO username;
GRANT CONNECT ON DATABASE gtck TO postgres;
Grant USAGE on schema
# GRANT USAGE ON SCHEMA schema_name TO username;
GRANT USAGE ON SCHEMA gtck TO postgres;
# GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA schema_name TO username;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA gtck TO postgres;
# GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA schema_name TO username;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA gtck TO postgres;
# GRANT ALL PRIVILEGES ON DATABASE database_name TO username;
GRANT ALL PRIVILEGES ON DATABASE gtck TO postgres;
https://tableplus.com/blog/2018/04/postgresql-how-to-grant-access-to-users.html
PostgreSQL - How to grant access to users?
How to grant access to users in PostgreSQL?
tableplus.com
반응형