在我的計算機上丟失了所有數據(必須讓Apple商店刪除所有內容)後,我使用Homebrew在我的Mac上安裝了postgres,命令爲brew install postgres
。然後我就開始在服務器(與確認該服務器啓動),並試圖創建一個使用Postgres的一個西納特拉項目數據庫,使用命令postgres服務器已啓動但無法連接到服務器
createdb db_development
但是,我得到了以下錯誤:
createdb: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
網上搜索後,我發現,我可能要運行以下命令initdb的
initdb /usr/local/var/postgres
但是當我做到了,我得到這個消息
initdb /usr/local/var/postgres
The files belonging to this database system will be owned by user "braindead".
This user must also own the server process.
The database cluster will be initialized with locale "en_CA.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
initdb: directory "/usr/local/var/postgres" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/usr/local/var/postgres" or run initdb
with an argument other than "/usr/local/var/postgres".
那麼,爲什麼會Postgres的已經證實的服務器在同一時間,我得到這個錯誤could not connect to database postgres: could not connect to server: No such file or directory
已經開始了,我怎麼能解決這個問題?
的READ.me爲項目說
bundle install
createdb db_development
rake db:migrate