Can't to log in postgres account by pgAdmin

Solution 1:

There's a postgres unix user account password, which you can change using passwd as root.

There is also a totally unrelated postgres role in the database, which might have a password of its own. This is totally unaffected by the passwd command. If you have forgotten this password, you have to reset it within PostgreSQL. See:

  • https://stackoverflow.com/q/10845998/398670
  • https://dba.stackexchange.com/q/19643/7788

etc.

The reason it works from psql but not PgAdmin is probably that you'll be using a unix socket with psql, using peer authentication to bypass password auth completely. If you've got localhost in your connection setup for PgAdmin it'll use TCP/IP instead, which is probably set to require md5 password authentication. Check your pg_hba.conf to confirm.