Mac-Osx

由於缺少伺服器配置文件,Postgres 無法在 lion 上啟動

  • October 18, 2014

我正在嘗試在相對乾淨的獅子安裝上設置 pg,但它沒有成功。

首先,我成功安裝了自製軟體,並安裝了 postgresql,沒有任何錯誤。

然後我嘗試執行一個rails應用程序,出現錯誤。嘗試執行此腳本: http: //nextmarvel.net/blog/2011/09/brew-install-postgresql-on-os-x-lion/

為了隱藏預設系統 postgres 安裝,但現在我收到以下錯誤:

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在 bin 目錄中執行腳本時,出現以下錯誤:

larson:~ larson$ /usr/local/Cellar/postgresql/9.1.3/bin/postgres ; exit;
postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
logout

很明顯,postgres 無法啟動,因為它沒有正確配置。有人對配置它以使其啟動的正確方法有任何建議嗎?

盲目地執行自製腳本而不知道它們在做什麼並不能解決問題——它會創建它們。結束咆哮。

我們不知道您之前遇到的錯誤是什麼,但現在您顯然沒有配置數據庫集群。

您需要正確設置 Postgres 集群(請參閱Postgres 手冊),和/或在啟動時告訴 postgres 數據庫集群所在的位置(這是You must specify the --config-file or -D invocation option or set the PGDATA environment variable.錯誤消息中的內容)。 手冊的第 17.3 節討論了這一點。

引用自:https://serverfault.com/questions/383892