按照官網步驟即可安裝成功
https://www.vnewin.com/day3-macos-install-postgresql-pgadmin/
添加psql命令到環境變數
psql命令在以下路徑
/Applications/Postgres.app/Contents/Versions/12/bin
將這個路徑加入$PATH後面即可
一般來說Application Server連接DB的帳密不應是super user權限
一般來說只允許寫跟讀跟刪除
不允許Drop Table
CREATE ROLE test_admin LOGIN PASSWORD 'admin_password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE ROLE test_user LOGIN PASSWORD 'user_password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE ROLE test_readonly LOGIN PASSWORD 'readonly_password' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
CREATE DATABASE test_db;
ALTER DATABASE test_db OWNER TO test_admin;