創建一個遠程維護資料庫dba用戶,具有創建資料庫與創建用戶的權限
CREATE USER dba PASSWORD 'dba' CREATEDB CREATEUSER;
進入psql
$ psql psql (9.1.6) Type "help" for help. postgres=# CREATE USER dba PASSWORD 'dba' CREATEDB CREATEUSER; CREATE ROLE postgres=# \q
使用psql登錄
$ psql -hlocalhost -Udba postgres Password for user dba: psql (9.1.6) SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256) Type "help" for help. postgres=#