Take the 2-minute tour ×

In the short version of postgres' installing it tell me to do the following

gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

Now I created the postgres user, but it sometimes asks for my credentials for that user. Is there a default password for the postgres user? Why do I even need to make another user?


share|improve this question
I see a close, should I migrate this to sever fault or super user? –  Doboy Mar 23 '12 at 6:14
add comment

2 Answers

Set the default password in the .pgpass file. If the server does not save the password, it is because it is not set in the .pgpass file, or the permissions are open and the file is therefore ignored.

Read more about the password file here.

Also, be sure to check the permissions: on *nix systems the permissions on .pgpass must disallow any access to world or group; achieve this by the command chmod 0600 ~/.pgpass. If the permissions are less strict than this, the file will be ignored.

Have you tried logging-in using PGAdmin? You can save the password there, and modify the pgpass file.

share|improve this answer
add comment
up vote 10 down vote accepted


share|improve this answer
tl;dr sudo passwd postgres to set the password –  hughes Jan 11 at 20:37
By all means read the linked answer, sudo passwd postgres should not be used, instead run sudo -u postgres psql postgres and enter \password postgres. –  hlovdal Feb 12 at 0:16
add comment

Your Answer


