創(chuàng)建用戶,用戶名和linux用戶名保持一致:
create user <user-name> with password '******';
賦予創(chuàng)建數(shù)據(jù)庫的權(quán)限:
alter user <user-name> createdb;
為了方便登錄,創(chuàng)建和用戶名一致的數(shù)據(jù)庫:
create database <db-name> owner <user-name>;
將該數(shù)據(jù)庫的所有權(quán)限賦予給相應(yīng)用戶:
grant all privileges on database <db-name> to <user-name>;
修改密碼:
alter user postgres with password 'new password';