1

Topic: psql: FATAL: Peer authentication failed for user "postgres"

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

When I installed iRedMail, I chose a password for PostgreSQL admin user.  See output below. 

PostgreSQL:
    * Admin user: postgres, Password: xxxxxxxx
    * Bind account (read-only):
        - Name: vmail, Password:xxxxxxxxxxxxxxxxxxxxxxxxx
    * Vmail admin account (read-write):
        - Name: vmailadmin, Password: xxxxxxxxxxxxxxxxxxxxxxxx
    * Database stored in: /var/lib/pgsql/data
    * RC script: /etc/init.d/postgresql
    * Log file: /var/log/postgresql/
    * See also:
        - /root/iRedMail-0.9.6/runtime/pgsql_init.pgsql
        - /var/lib/pgsql/.pgpass

SQL commands used to initialize database and import mail accounts:
    - /root/iRedMail-0.9.6/runtime/*.sql



However, when I try to login as 'prostres' as the admin user, I get the error: "psql: FATAL:  Peer authentication failed for user "postgres".

This is the command I'm using to login:
psql -U postgres

Any thoughts?

Also how can I set the root password?  I'm installing phpmyadmin, and requires root user and password.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: psql: FATAL: Peer authentication failed for user "postgres"

Switch to "postgres" system account with "su" first, then you don't need any password to access the database.

3

Re: psql: FATAL: Peer authentication failed for user "postgres"

ZhangHuangbin wrote:

Switch to "postgres" system account with "su" first, then you don't need any password to access the database.


Thank you very much for the quick reply.  That worked. 

Another question: when phpmyadmin asks for password for root user, what's the root password?
Or alternatively, can I use postgress as user, and then the p/w I created when I installed iRedMail?
Thanks.

4

Re: psql: FATAL: Peer authentication failed for user "postgres"

phpMyAdmin doesn't support PostgreSQL. You may need phpPgAdmin instead.