[英]First Heroku, Ruby & Postgres App - Local Postgres Error
我一直在遵循Heroku的Heroku上的Ruby入门指南,并且一直试图连接到postgres数据库而陷入困境。
当我跑步时:
bundle exec rake db:create db:migrate
我留下了这个错误:
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
和:
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"garrett", "username"=>"ruby-getting-started"}
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
我尝试编辑database.yml文件,但是不确定是否要更改正确的参数:
default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5
development:
<<: *default
database: ruby-getting-started_development
username: ruby-getting-started
test:
<<: *default
database: ruby-getting-started_test
production:
<<: *default
database: ruby-getting-started_production
username: ruby-getting-started
password: <%= ENV['RUBY-GETTING-STARTED_DATABASE_PASSWORD'] %>
我的database.yml设置是否错误或完全错误?
这是一个常见的Postgres错误,基本上是在告诉您找不到服务器。 这可能是由于各种原因导致的,从未安装到OS更新的路径断开。
如果确实安装了服务器,则可以通过Homebrew或postgres.org上的GUI Windows安装程序重新安装它。
无论哪种方式,最快的解决方法都是使用Mac的Postgres.app之类的单个软件包安装程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.