PostgreSQL: Why psql can't connect to server?

前端 未结 22 2193
情书的邮戳
情书的邮戳 2020-12-07 10:40

I typed psql and I get this:

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    con         


        
22条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-07 11:15

    Verify that Postgres is running using:

    ps -ef | grep postgres
    
    root@959dca34cc6d:/var/lib/edb# ps -ef|grep postgres
    enterpr+    476  1  0 06:38 ?        00:00:00 /usr/lib/edb-as/11/bin/edb-postgres -D /var/lib/edb-as/11/main2 -c config_file=/etc/edb-as/11/main2/postgresql.conf
    

    Check for data directory and postgresql.conf.

    In my case data directory in -D was different than that in postgresql.conf

    So I changed the data directory in postgresql.conf and it worked.

提交回复
热议问题