DRYな備忘録

Don't Repeat Yourself.

Postgresがcould not connect to server: No such file or directoryって言う

問題

% psql -l
psql: 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"?

思い当たること(ちがった)

Macグラボの調子が悪いかなんかでGeniusカフェ行ったんっすよ。特殊な再起動したりOSテスト走らせたりしてたので、launchctlまわりかなと思って以下を試したが、全く意味なし。

% launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
% launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

launchctlってたぶん起動時の挙動をあれこれするだけなので、今動いてないpsql serverには関係ないっぽい

MacWiki - コマンド/launchctl

とりあえずこれで治った

ruby on rails 3 - Postgres could not connect to server - Stack Overflow

が、しかし、もちろんデータは吹っ飛ぶので、必要なDBはcreatedbしなおす

% rm -rf /usr/local/var/postgres
% initdb /usr/local/var/postgres -E utf8

いやー野蛮な解決だな...

DRY