[Postgres ์ ‘์† ์—๋Ÿฌ] : could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

2021. 8. 25. 16:29ใ†๐Ÿ“” TIL

์ƒํ™ฉ : nestjs ์„œ๋ฒ„ ์ ‘์†์‹œ db ์—ฐ๊ฒฐ์ด ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ ๋ฐœ์ƒ

์—๋Ÿฌ๋ฉ”์‹œ์ง€ : could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

 

์›์ธ: pg ์„œ๋ฒ„๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์ข…๋ฃŒ๋˜์ง€ ์•Š์•„ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ (postgres server๊ฐ€ ๋‹ซํžŒ ์ƒํƒœ)

ํ•ด๊ฒฐ๋ฐฉ๋ฒ•: ํ„ฐ๋ฏธ๋„์—์„œ ์•„๋ž˜ ๊ฒฝ๋กœ๋กœ ์ ‘์†ํ•˜์—ฌ postmaster.pid ํŒŒ์ผ์„ ์ฐพ๋Š”๋‹ค.

$ /Users/<user>/Library/Application\ Support/Postgres/var-13

$ ls // ls ๋ช…๋ น์–ด๋กœ ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด์˜ ์กด์žฌ ํŒŒ์ผ ํ™•์ธ -> postmaster.pid ํŒŒ์ผ ์กด์žฌ์‹œ ์‚ญ์ œ
$ rm postmaster.pid