[PostgreSQL] '/tmp/.s.PGSQL.5432' 오류

yebeen·2022년 11월 24일
0

GEMSTONE

목록 보기
3/4
post-thumbnail
# 버전 확인
$ postgres -V

버전은 14.5 였습니다.

접속 오류

api 작업을 하기 위해서 postgresql에 접속해려고하는데 아래와 같은 오류가 발생 !

psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL:  database does not exist

발생 이유는

내부 postmaster.pid 파일이 발생시키는 Process 충돌 때문!! (나를 괴롭히지마.. 😂)

해결방법은

1. 서버 종료 후 재실행

  # 1. postgres 서버 종료
$ brew services stop postgresql
  # 2. pid 삭제
$ rm /opt/homebrew/var/postgres/postmaster.pid 
  # 3. postgres 서버를 재실행
$ brew services start postgresql

위 방법으로는 해결되지 않았습니다..

2. 삭제 후 재설치 (사용한 방법)

  # 종료
$ brew services stop postgresql
  # 삭제
$ brew uninstall --force postgresql
  # postgresql 관련 파일들 삭제
$ rm -rf /opt/homebrew/var/postgres && rm -rf .psql_history .psqlrc .psql.local .pgpass .psqlrc.local
$ brew cleanup
  # 삭제 확인
$ brew list | grep sql
  # 재설치
$ brew install postgresql
  # 서비스 시작
$ brew services start postgresql
  # 접속
$ psql postgres

이후 설치된 버전은 14.6! 업그레이드 했을 때 최신버전이라고 했었는데.. 잘 모르겠습니다.😂
다른 블로그를 확인했을 때 13버전으로 했을 때 된다고 한 글도 봤었는데, 그것도 되진 않았었고.. 그냥 최신 버전으로 다운받으니 됐다. 처리했지만 처리하지 않은 느낌 휴


profile
🐣🐥

0개의 댓글