700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > psql: could not connect to server: No such file or directory

psql: could not connect to server: No such file or directory

时间:2022-02-08 22:07:28

相关推荐

psql: could not connect to server: No such file or directory

psql: could not connect to server: No such file or directory

SOLUTION 已验证- 已更新三月27日19:52-

English

环境

Red Hat Enterprise Linux 6 (RHEL)PostgreSQL database

问题

We are unable to login the PostgreSQL database of Jon server application using the command psql. Tried to login as postgres and root user, but getting the same error. Please see the error details below and guide us fix this error ASAP.

Raw

bash-4.3$ psqlpsql: could not connect to server: No such file or directoryIs the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?

决议

The error message indicates thatpostgresqlservice is not running and listening to default tcp port 5432. Use the below command and confirm tcp port used bypostgresqlservice. Then use correct command to connect it. For example :

Raw

# ps -ef | grep postgrespostgres 60431 0 16:20 ? 00:00:00 /usr/bin/postgres -D /var/lib/pgsql/data -p 5454postgres 6044 6043 0 16:20 ? 00:00:00 postgres: logger process postgres 6046 6043 0 16:20 ? 00:00:00 postgres: checkpointer process postgres 6047 6043 0 16:20 ? 00:00:00 postgres: writer process postgres 6048 6043 0 16:20 ? 00:00:00 postgres: wal writer process postgres 6049 6043 0 16:20 ? 00:00:00 postgres: autovacuum launcher process # bash-4.3$ psql rhq --host=localhost --port=5454 --username=rhqadmin --password Password for user rhqadmin: psql (9.2.0)Type "help" for help.rhq=>

根源

Thepostgresqlservice was running on port 5454 instead of default port 5432.

诊断步骤

Collect the following commands output and check tcp port used bypostgresqlservice

Raw

# ps -ef | grep postgres# netstat -tulnp | grep postgres

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。