PostgreSQL: Why psql can't connect to server?

前端 未结 22 2132
情书的邮戳
情书的邮戳 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 10:49

    My issue with this error message was in wrong permissions on key and pem certificates, which I have manipulated. What helped me a lot was: /var/log/postgresql/postgresql-9.5-main.log where are all the errors.

    0 讨论(0)
  • 2020-12-07 10:51

    So for me and my pals working on a Node.js app (with Postgres and Sequelize), we had to

    1. brew install postgresql (one of us was missing postgres, one of us was not, and yet we were getting the same error msg as listed above)

    2. brew services start postgresql **** (utilize Homebrew to start postgres)

    3. createdb <name of database in config.json file>

    4. node_modules/.bin/sequelize db:migrate

    5. npm start

    0 讨论(0)
  • 2020-12-07 10:52

    I was facing same problem and

    sudo su - postgres
    initdb --locale en_US.UTF-8 -D /var/lib/postgres/data
    exit
    sudo systemctl start postgresql
    sudo systemctl status postgresql
    

    This worked for me.

    0 讨论(0)
  • 2020-12-07 10:52

    Solved it! Although I don't know what happened, but I just deleted all the stuff and reinstalled it. This is the command I used to delete it sudo apt-get --purge remove postgresql\* and dpkg -l | grep postgres. The latter one is to find all the packets in case it is not clean.

    0 讨论(0)
  • 2020-12-07 10:52

    I resolved this problem by checking my file system the disk was completely full, and so database could not start up

    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432" ?

    I tried series of troubleshooting, until when i checked my disk usage and found that it was full, 100% usage,

    df -h
    cd /var/log/odoo/
    cat /dev/null > odoo-server.log
    reboot
    
    0 讨论(0)
  • 2020-12-07 10:52

    Restarting the instance worked for me. Also, as mentioned in some other post psql -h '/tmp' worked as well before the restart. But post restart psql directly started working. So, probably some file ownership issues that got reset with the restart is what I am thinking.

    0 讨论(0)
提交回复
热议问题