Postgres를 시작할 수 없는 경우

같은 기사가 많지만 자기가 쓴 노트.

발생한 오류


$ psql
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"?

brew 서비스에서 다시 시작하기


$ brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
$ psql
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"?
상태가 변하지 않습니다.

Postgres를 시작합니다.


$ postgres -D /usr/local/var/postgres
2020-12-24 20:52:11.632 JST [15536] FATAL:  lock file "postmaster.pid" already exists
2020-12-24 20:52:11.632 JST [15536] HINT:  Is another postmaster (PID 406) running in data directory "/usr/local/var/postgres"?

lock file이 남아서 지워볼게요


$ rm /usr/local/var/postgres/postmaster.pid

brew 서비스에서 다시 시작하기


$ brew services restart postgresql
Stopping `postgresql`... (might take a while)
==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql)
==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)

psql 연결


$ psql
psql (12.3)
Type "help" for help.

tetsuya=# 
( ˘ω˘ )

좋은 웹페이지 즐겨찾기