2016-06-14 3 views
0

PostgreSQL을 사용하여 프로덕션 모드에서 내 Rails 앱용 데이터베이스를 만들려고합니다.Rails 용 프로덕션 데이터베이스를 만들 수 없습니다.

나는 명령을 실행하면 : 나는 다음과 같은 오류가

$ RAILS_ENV=production rake db:create 

:

FATAL: database "postgres" does not exist 
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "host"=>"localhost", "database"=>"provenword", "pool"=>5, "username"=>"postgres", "password"=>"password"} 

은 내가이 나이 레일 애플 리케이션을위한 데이터베이스를 만들 수 있습니다. 그러나,이 하나만 나 에게이 오류를 제공합니다. 데이터베이스를 생성하고 응용 프로그램을 실행할 수 있도록이 작업을 수행하려면 어떻게해야합니까?

보석 파일 :

.. 
    gem 'pg' 
.. 

레일 버전 - 4.2.6

데이터베이스 YML

# 
default: &default 
    adapter: sqlite3 
    pool: 5 
    timeout: 5000 

# default: &default 
# user: postgres 
# password: password 
# pool: 5 
# timeout: 5000 



development: 
    <<: *default 
    database: db/development.sqlite3 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    <<: *default 
    database: db/test.sqlite3 

production: 
    adapter: postgresql 
    encoding: unicode 
    host: localhost 
    database: provenword 
    pool: 5 
    username: postgres 
    password: password 

PostgreSQL는 내 서버에 설치되어 있습니다.

+0

을 설치되어 있습니까? 'which psql'는 postgresql을 찾는 데 도움이 될 것입니다. – Emu

+0

나는 postgres와 유효한 보석을 사용하고 싶다고 생각했다. 제작에 설치하지 않았을 수도있다. – PatNowak

+1

나는'postgresql'을 믿는다.'postgres'의 사용자 이름과 같은 이름의 데이터베이스가 있어야한다. 먼저'postgres'라는 이름으로 데이터베이스를 설정하면'RAILS_ENV = production rake db : create'를 실행할 수 있습니다. – Dharam

답변

0

덕분에 @Dharam.

그것은 나를위한 작품은 물론이다 : 포스트 그레스는 서버에

I beleive postgresql expects a database with the same name as the user name, in your case postgres , be present. First setup a database with the name postgres then you can run RAILS_ENV=production rake db:create

관련 문제