createdb のエラー対応
実行コマンド:
createdb hoge
エラー内容:
error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?
解決策:
sinatra % brew services start postgresql ==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql) sinatra % brew services stop postgresql Stopping `postgresql`... (might take a while) ==> Successfully stopped `postgresql` (label: homebrew.mxcl.postgresql) sinatra % brew services restart postgresql ==> Successfully started `postgresql` (label: homebrew.mxcl.postgresql)
理由:
> createdb: could not connect to database template1: 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"?
> これは、サーバが起動していないか、createdbが想定している状態でサーバが起動していないかを示しています。 こちらも、インストール手順を点検するか管理者に相談し
=>サーバーをスタートさせる。または、リロードして設定の反映を完了させる。
参考: