I am running postgres 15 in linux box. Started the postgres with services and it is running successfully.
[root@server123 ~]# systemctl start postgresql.service
[root@server123 ~]# systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/postgresql.service.d
└─override.conf
Active: active (running) since Fri 2024-06-14 19:26:18 IST; 29min ago
Process: 33815 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
Main PID: 33818 (postmaster)
Tasks: 7 (limit: 100388)
Memory: 19.2M
CGroup: /system.slice/postgresql.service
├─33818 /usr/bin/postmaster -D /pgsql_15/data
├─33818 /usr/bin/postmaster -D /pgsql_15/data
├─33821 postgres: logger
├─33822 postgres: checkpointer
├─33823 postgres: background writer
├─33825 postgres: walwriter
├─33826 postgres: autovacuum launcher
└─33827 postgres: logical replication launcher
Also verified the postgres from ps -ef
[root@server123 ~]# ps -ef | grep postgres
postgres 33818 1 0 19:26 ? 00:00:00 /usr/bin/postmaster -D /pgsql_15/data
postgres 33821 33818 0 19:26 ? 00:00:00 postgres: logger
postgres 33822 33818 0 19:26 ? 00:00:00 postgres: checkpointer
postgres 33823 33818 0 19:26 ? 00:00:00 postgres: background writer
postgres 33825 33818 0 19:26 ? 00:00:00 postgres: walwriter
postgres 33826 33818 0 19:26 ? 00:00:00 postgres: autovacuum launcher
postgres 33827 33818 0 19:26 ? 00:00:00 postgres: logical replication launcher
root 34198 33900 0 19:58 pts/0 00:00:00 grep --color=auto postgres
owner and permission of pgsql_15/data
drwxr-x---. 4 postgres postgres 4096 Jun 14 16:32 pgsql_15
owner and permission of /usr/bin/psql
-rwxr-xr-x 1 root root 821280 Feb 9 18:42 psql
I have put trust method for local connections
# "local" is for Unix domain socket connections only
local all all scram-sha-256
# IPv4 local connections:
host all all 127.0.0.1/32 trust #scram-sha-256
# IPv6 local connections:
host all all ::1/128 trust #scram-sha-256
But when I try connect psql through postgres user it asks for password.
[root@server123 ~]# su - postgres
Last login: Fri Jun 14 19:51:31 IST 2024 on pts/0
[postgres@server123 ~]$ psql
Password for user postgres:
I want to connect to database through psql mode where without password. Where i am making wrong. please help.
1