报错一:
[postgres@vm-node2 ~]$ psql
psql: 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"?
先查看服务端口是否正常开启
[postgres@vm-node2 opt]$ netstat -ntulp |grep 5432
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 17505/postgres
tcp6 0 0 :::5432 :::* LISTEN 17505/postgres
然后需要换一种登录方式
[postgres@vm-node2 ~]$ /usr/bin/psql -p 5432 -U postgres -h 127.0.0.1
Password for user postgres:
psql (9.6.24)
Type "help" for help.
postgres=#
postgres=#
postgres=#