18

I entered postgres console with sudo and did this:

create user uu with password 'uu';    
create database u_db owner uu;   
grant all privileges on u_db to uu;

Error: Relation u_db doesnt exist.

1

1 Answer 1

32

You have to use the keyword DATABASE for granting here. So I'm posting you the output from psql in:

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

However. IMHO through the owner setting of database you don't need to grant extra rights for the user uu.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.