2014-04-24 82 views
6

我進入Postgres的控制檯使用sudo,這樣做,當關系犯規存在錯誤。PostgreSQL的授予特權時

+0

'授予DATABASE u_db所有權限給uu;'([更多信息](http://www.postgresql.org/docs/current/static/sql-grant.html)) –

回答

12

您必須在此處使用關鍵字DATABASE進行授予。所以我發佈你psql的輸出:

postgres=# create user uu with password 'uu'; 
CREATE ROLE 
postgres=# create database u_db owner uu; 
CREATE DATABASE 
postgres=# grant all privileges on u_db to uu; 
FEHLER: Relation »u_db« existiert nicht 
postgres=# grant all privileges on database u_db to uu; 
GRANT 

不過。恕我直言,通過數據庫的所有者設置,你不需要授予用戶uu的額外權利。