在我的计算机上丢失了所有数据(必须让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