PostgreSQL: Why psql can't connect to server?

前端 未结 22 2147
情书的邮戳
情书的邮戳 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:09

    If your service is not secure, this may be the reason

    vi /etc/postgresql/11/main/pg_hba.conf
    
    1. open hba config file, this config file usualy located in the etc directory.
    host    all   all    localhost trust   md5
    
    1. you can remove the trust keyword

    2. save pg_hba.conf

    3. sudo service postgresql restart.

提交回复
热议问题