Is the server running on host “localhost” (::1) and accepting TCP/IP connections on port 5432?

前端 未结 17 1572
北荒
北荒 2020-12-02 06:37

Before anything, please note that I have found several similar questions on Stack Overflow and articles all over the web, but none of those helped me fix my issue:

相关标签:
17条回答
  • 2020-12-02 07:38

    I have faced the same issue and I was unable to start the postgresql server and was unable to access my db even after giving password, and I have been doing all the possible ways.

    This solution worked for me,

    For the Ubuntu users: Through command line, type the following commands:

    1.service --status-all (which gives list of all services and their status. where "+" refers to running and "-" refers that the service is no longer running)

    check for postgresql status, if its "-" then type the following command

    2.systemctl start postgresql (starts the server again)

    refresh the postgresql page in browser, and it works

    For the Windows users:

    Search for services, where we can see list of services and the right click on postgresql, click on start and server works perfectly fine.

    0 讨论(0)
  • 2020-12-02 07:39

    Step 1:

    cd /etc/postgresql/12/main/
    

    open file named postgresql.conf

    sudo nano postgresql.conf
    

    add this line to that file

    listen_addresses = '*'
    

    then open file named pg_hba.conf

    sudo nano pg_hba.conf
    

    and add this line to that file

    host  all  all 0.0.0.0/0 md5
    

    It allows access to all databases for all users with an encrypted password

    restart your server

    sudo /etc/init.d/postgresql restart
    
    0 讨论(0)
  • 2020-12-02 07:40

    Most likely it's because your system shutdown unexpectedly

    Try

    postgres -D /usr/local/var/postgres
    

    You might see

    FATAL:  lock file "postmaster.pid" already exists
    HINT:  Is another postmaster (PID 449) running in data directory "/usr/local/var/postgres"?
    

    Then try

    kill -9 PID
    

    example

    kill -9 419
    

    And it should start postgres normally

    0 讨论(0)
  • This worked for me: run

    sudo lsof -i :<port_number>

    after that it will display the PID which is currently attached to the process.

    After that run sudo kill -9 <PID>

    if that doesn't work, try the solution offered by user8376606 it would definitely work!

    0 讨论(0)
  • 2020-12-02 07:42

    In my case

    1. I have changed the port in postgresql.conf file
    2. and restart postgresql services in

    Run => service.msc => Restart

    1. now retry
    0 讨论(0)
提交回复
热议问题