添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
帅气的小摩托  ·  在 Azure Boards ...·  11 月前    · 
不要命的野马  ·  获取当前的用户名·  1 年前    · 

Hi, I’m building the appointment scheduler and for a few days now I’ve been getting this message when I try to connect to psql:
codeally@c57ab2b73578:~/project$ psql --username=freecodecamp dbname=postgres
psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
Is the server running locally and accepting connections on that socket?
In the other terminal I get some equivalent message when trying to run my bash script.
Is this a problem with codeally or is it something I can fix on my machine?
Thanks a lot!

It might be related to one of the outages, freeCodeCamp and CodeAlly both had some issues recently - as well as updates.

Enter these commands in the terminal:

  • sudo cp ./.freeCodeCamp/pg_hba.conf /etc/postgresql/12/main/pg_hba.conf
  • sudo chown -R postgres:postgres /var/lib/postgresql/12/main
  • sudo service postgresql restart
  • echo "SELECT 'CREATE USER freecodecamp WITH CREATEDB' WHERE NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname='freecodecamp')\gexec" | psql -U postgres -X
  • They’re the commands that run when you start that project to set things up. Try to login again after that. Let me know if it works.

    I am getting this error in the third command, help please!

    Error: /usr/lib/postgresql/12/bin/pg_ctl /usr/lib/postgresql/12/bin/pg_ctl start -D /var/lib/postgresql/12/main -l /var/log/postgresql/postgresql-12-main.log -s -o  -c config_file="/etc/postgresql/12/main/postgresql.conf"  exited with status 1: 
    pg_ctl: another server might be running; trying to start server anyway
     FATAL:  could not remove old lock file "postmaster.pid": Read-only file system
     HINT:  The file seems accidentally left over, but it could not be removed. Please remove the file by hand and try again.
    pg_ctl: could not start server
    Examine the log output.
                  

    In my case sudo service postgresql restart did not work. I got pg_ctl: could not start server

    codeally@c04db3918a02:~/project$ sudo service postgresql restart
     * Restarting PostgreSQL 12 database server                                                                                                           * Error: /usr/lib/postgresql/12/bin/pg_ctl /usr/lib/postgresql/12/bin/pg_ctl start -D /var/lib/postgresql/12/main -l /var/log/postgresql/postgresql-12-main.log -s -o  -c config_file="/etc/postgresql/12/main/postgresql.conf"  exited with status 1: 
    2022-09-14 14:35:39.122 UTC [3495] LOG:  starting PostgreSQL 12.9 (Ubuntu 12.9-2.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit
    2022-09-14 14:35:39.122 UTC [3495] LOG:  listening on IPv4 address "127.0.0.1", port 5432
    2022-09-14 14:35:39.122 UTC [3495] LOG:  could not bind IPv6 address "::1": Cannot assign requested address
    2022-09-14 14:35:39.122 UTC [3495] HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
    2022-09-14 14:35:39.130 UTC [3495] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    2022-09-14 14:35:39.155 UTC [3496] LOG:  database system shutdown was interrupted; last known up at 2022-09-14 14:32:27 UTC
    2022-09-14 14:35:39.199 UTC [3496] LOG:  database system was not properly shut down; automatic recovery in progress
    2022-09-14 14:35:39.204 UTC [3496] LOG:  redo starts at 0/1829EB8
    2022-09-14 14:35:39.204 UTC [3496] LOG:  invalid record length at 0/182A288: wanted 24, got 0
    2022-09-14 14:35:39.204 UTC [3496] LOG:  redo done at 0/182A210
    2022-09-14 14:35:39.231 UTC [3496] PANIC:  could not fdatasync file "000000010000000000000001": Input/output error
    2022-09-14 14:35:39.337 UTC [3495] LOG:  startup process (PID 3496) was terminated by signal 6: Aborted
    2022-09-14 14:35:39.337 UTC [3495] LOG:  aborting startup due to startup process failure
    2022-09-14 14:35:39.338 UTC [3495] LOG:  database system is shut down
    pg_ctl: could not start server
    Examine the log output.
    

    Then I had also to run sudo chmod 644 /etc/postgresql/12/main/pg_hba.conf

    Source error:

    psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
            Is the server running locally and accepting connections on that socket?
        Hi, I’m building the appointment scheduler and for a few days now I’ve been getting this message when I try to connect to psql: 
    codeally@c57ab2b73578:~/project$ psql --username=freecodecamp dbname=postgres 
    psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory 
    Is the server running locally and accepting connections on that socket? 
    In the other terminal I get some equivalent message when trying to run my bash script. 
    Is this a proble…
        codeally@8576f6138a56:~/project$ psql -U postgres < periodic_table.sql 
    psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory 
    Is the server running locally and accepting connections on that socket? 
    Does this mean that the server used to connect to the database is down? I was coding element.sh when I got a message stating that element.sh could not be saved… 
    So I copied my code to a backup location. Did I code something that crashed th…
    

    It started all of a sudden yesterday, when I was working on Build a Mario Database lesson. I’ve waited until today to see if it wasn’t a bug that would be patched, but until now I keep getting the same error.

    When following the step 2 on the comment below, I get a Bad command error.

    moT01:

    sudo chown -R postgres:postgres /var/lib/postgresql/12/main

    I have same problem in Periodic Table Database:

    psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

    Please help

    How can save me at the end? Number Guessing Game - Build a Number Guessing Game Backend Development Thank you, now I know. slight_smile

    Thank you!

    The web based version of the Relational Database curriculum is here! Follow the steps below to run the courses in your browser. If you want to run them locally instead, you can learn how here. Note: you cannot earn your certification running these locally. How to get started Follow these steps to get started with the browser version of the courses: First, you will need to create a GitHub account if don’t have one If you don’t want to save your progress, you can skip to step 4 after you have…

    I have the same problem and the solution you give here does not work, it gives an error in the first line

    I recently am experiencing the same problem while completing "Learn SQL by Building a Student Database: Part 2 ":
    psql: error: connection to server on socket “/var/run/postgresql/.s.PGSQL.5432” failed: No such file or directory
    Is the server running locally and accepting connections on that socket?
    There’s no apparent fix and it won’t connect to the POSTGRESQL server.
    Please anyone with knowledge on how to fix this?