❗️Error

Connection to localhost:5432 refused.

hellohailie 2024. 4. 15. 23:33

 

로컬에서 백엔드를 실행하는데 연결이 되지 않아서 터미널을 봤더니 아래와 같은 메세지가 나왔습니다. 

Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

 

그리고 디비버를 실행했더니 친절하게 PostgreSQL에 문제가 있다고 알려줬습니다. 

 

다양한 원인이 있겠지만, 쉽고 간단하게 다시 PostgreSQL 을 연결하는 방법으로 문제를 해결했습니다. 

 

바로바로 삭제 후 재설치!

 

# postgresql이 설치되어 있는것들을 모두 삭제 합니다.
$ brew uninstall postgresql

# 설치 되어있는 postgresql을 확인합니다.
$ brew search postgresql

# postgresql를 설치합니다.
$ brew install postgresql@14

# postgresql 서비스를 수행시킵니다.
$ brew services start postgresql

# postgresql 서비스 수행중인 리스트를 확인합니다
$ brew services list