init postgres password
I just reinstalled my Laptop and it now become Ubuntu 12.04 LTS, I love this.
After whole day of installing, finally I got my postgresql installed, it is a good time to record how to initialize password for new installed postgresql.
1 | |
This will set your postgres USER’s password into postgres.
Then just use psql -U postgres -h 127.0.0.1 to logon.
But if you encounteredsql: FATAL: password authentication failed for user "postgres"
then check the file /etc/postgresql/{VERSION}/main/pg_hba.conf:
There must be a line like this as the first non-comment line:local all postgres ident
After this, remember to restart your postgresql.
For newer versions of PostgreSQL ident actually might be peer. That’s OK also.
init postgres password
https://rug.al/2014/2014-03-04-init-postgres-password/