Oracle Database Release and support Timelines
Error : psql: error: could not connect to server: No such file or directory
-bash-4.2$ psql
psql: error: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
-bash-4.2$
Check wheather postgres cluster is running or not using below comand
-bash-4.2$ ps -ef | grep -i postgres
root 3318 3253 0 06:05 pts/0 00:00:00 sudo su - postgres
root 3319 3318 0 06:05 pts/0 00:00:00 su - postgres
postgres 3320 3319 0 06:05 pts/0 00:00:00 -bash
postgres 3494 3320 0 06:22 pts/0 00:00:00 ps -ef
postgres 3495 3320 0 06:22 pts/0 00:00:00 grep --color=auto -i postgres
-bash-4.2$
-bash-4.2$
If postgreSQL cluster is not running then strat using below command
-bash-4.2$
-bash-4.2$ pg_ctl -D /postgres/data/ start
waiting for server to start....2023-09-01 06:23:16.881 UTC [3508] LOG: starting PostgreSQL 12.16 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
2023-09-01 06:23:16.881 UTC [3508] LOG: listening on IPv4 address "0.0.0.0", port 5432
2023-09-01 06:23:16.881 UTC [3508] LOG: listening on IPv6 address "::", port 5432
2023-09-01 06:23:16.883 UTC [3508] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-09-01 06:23:16.887 UTC [3508] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2023-09-01 06:23:16.917 UTC [3508] LOG: redirecting log output to logging collector process
2023-09-01 06:23:16.917 UTC [3508] HINT: Future log output will appear in directory "log".
done
server started
-bash-4.2$
-bash-4.2$
verify using below commnads
-bash-4.2$
-bash-4.2$
-bash-4.2$ ps -ef | grep -i postgres
root 3318 3253 0 06:05 pts/0 00:00:00 sudo su - postgres
root 3319 3318 0 06:05 pts/0 00:00:00 su - postgres
postgres 3320 3319 0 06:05 pts/0 00:00:00 -bash
postgres 3508 1 0 06:23 ? 00:00:00 /usr/pgsql-12/bin/postgres -D /postgres/data
postgres 3509 3508 0 06:23 ? 00:00:00 postgres: logger
postgres 3511 3508 0 06:23 ? 00:00:00 postgres: checkpointer
postgres 3512 3508 0 06:23 ? 00:00:00 postgres: background writer
postgres 3513 3508 0 06:23 ? 00:00:00 postgres: walwriter
postgres 3514 3508 0 06:23 ? 00:00:00 postgres: autovacuum launcher
postgres 3516 3508 0 06:23 ? 00:00:00 postgres: stats collector
postgres 3517 3508 0 06:23 ? 00:00:00 postgres: logical replication launcher
postgres 3525 3320 0 06:23 pts/0 00:00:00 ps -ef
postgres 3526 3320 0 06:23 pts/0 00:00:00 grep --color=auto -i postgres
-bash-4.2$
-bash-4.2$
-bash-4.2$ psql
psql (12.16)
Type "help" for help.
postgres=# select version();
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 12.16 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
(1 row)
postgres=#
postgres=#
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]# passwd -l postgres
Locking password for user postgres.
passwd: Success
Check the user account status :
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]# passwd -S postgres
postgres LK 2022-10-04 -1 -1 -1 -1 (Password locked.)
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]#
If user Locked
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]# passwd -S postgres
postgres LK 2022-10-04 -1 -1 -1 -1 (Password locked.)
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]#
If user Unlocked
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]# passwd -S postgres
postgres PS 2022-10-04 -1 -1 -1 -1 (Password set, SHA512 crypt.)
[root@10.1.1.1 ~]#
[root@10.1.1.1 ~]#