psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
위의 오류인 경우 대부분 /usr/local/var/log/postgres.log(mac의 경우)를 체크할 경우 확인할 수 있다
2021-10-01 09:52:27.732 KST [57793] FATAL: database files are incompatible with server
2021-10-01 09:52:27.732 KST [57793] DETAIL: The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.4.
위의 오류는 postgres를 업그레이드한 경우에 주로 발생하고
brew postgresql-upgrade-database을 통해 해결 가능하다
2021-10-01 10:02:01.980 KST [62493] FATAL: lock file "postmaster.pid" already exists
위와같은 오류가 발생하면
rm /usr/local/var/postgres/postmaster.pid을 통해서 해결 가능하다