我想在我的機器上使用postgres
,並意識到前一段時間我運行brew install postgres
並收到Error: postgresql-9.4.5_2 already installed
後安裝了數據庫軟件。從那裏,我決定安裝homebrew/services
能夠在後臺運行的Postgres,併成功啓動,並與Postgres - 自制安裝無法找到服務器文件多個版本
brew services start postgresql==> Successfully started
PostgreSQL的關閉後臺作業(label: homebrew.mxcl.postgresql)
然而,當我運行postgres
我收到的錯誤:
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.
當我跟在SO答案,cat /usr/local/var/postgres/server.log
我收到以下錯誤:
LOG: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.5.
這讓我覺得我安裝了一個需要刪除的舊版PostgreSQL。
我又試圖psql
並獲得:
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"?
終於決定初始化一個新的數據庫與initdb /usr/local/var/postgres
,但沒有解決問題,這導致了下面的原始消息並設置一個ENV varible: export PGDATA=/usr/local/var/postgres
。再次嘗試postgres
後,我收到
LOG: skipping missing configuration file "/usr/local/var/postgres/postgresql.auto.conf"
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.4.5.
這告訴我的是,顯然還有一個版本的兼容性問題,這需要以啓動我的Postgres服務器來解決,但我不知道是什麼文件路徑需要清除或清除它們的正確方法。任何人可以提供一些指導?