2017-12-24 14 views
-2

저는 방금 기본 sqlite3 데이터베이스를 사용하는 응용 프로그램 작업을 시작했습니다. 나는 PostgreSQL 데이터베이스를 사용하도록 변경 한 다른 응용 프로그램으로 갔다. 그것은 wouldnt 연결하고 오류 페이지와 함께 올라와. 나는 내 PC (Windows 10)를 리셋 할 수 있도록 이전의 레일 서버 세션을 중단하지 않았을 것이라고 생각했다. 나는 다시 시작했고 같은 오류가났다.레일에서 로컬 서버를 시작하는 데 문제가 있습니까?

PG::ConnectionBad 

could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? 

Extracted source (around line #56): 

    ### Convenience alias for PG::Connection.new. 
    def self::connect(*args) 
     return PG::Connection.new(*args) 
    end 

실행중인 레일 서버 세션이 없는지 확인하는 방법이 있습니까?

database.yml을 연결 실패의 원인이 무엇

default: &default 
    adapter: postgresql 
    pool: 5 
    timeout: 5000 

development: 
    <<: *default 
    database: nutri_development 

test: 
    <<: *default 
    database: nutri_test 

production: 
    <<: *default 
    database: nutri_production 
    prepared_statements: false 
    encoding: unicode 

?

이 프로젝트가 진행되는 동안 로컬 호스트 3000 페이지를 사용했는데, 왜 이런 일이 발생하는지 이해하지 못합니다. 이 문제를 해결하는 데 도움이되도록 편집에 게시해야하는 다른 파일에 대해 조언하십시오.

+0

수 PC에서 postgresql이 온라인 상태인지 확인합니다. – coderhs

+0

가능한 복제본 https://stackoverflow.com/questions/13684915/kill-localhost3000-process-from-windows-command-line – Sree

+0

@coderhs 어떻게 확인할 수 있습니까? – Owen

답변

0

당신은 PostgreSQL을하고 페이지의 관리자가 다음

ontrack에서 아주 좋은 설명은이

을 따르고처럼 database.yml을 파일을 수정할 수 있습니다 PostgreSQL을

을 전환하려고 설치 확인해야합니다 아래

#=> config/databse.yml 
default: &default 
    adapter: postgresql 
    encoding: unicode 
    username: postgres #=> which you postgresql username 
    password: xxxxxx #=> your postgresql password 

development: 
    <<: *default 
    database: project_development 
이 명령으로 레일 프로젝트를 생성하는 경우

rails new project --database=postgresql 

모든 설정은 usernamepassword PG 소개

Tutorial

내가 도움이 될 것입니다 생각 단계로

Youtube

단계를 설치 편집 할 필요가 기본적으로 사용하는

+0

어떻게 사용자 이름과 암호를 만드나요?. 나는이 vaiables가 어디서 왔는지 이해하지 못한다. 내가 postgresql을 실행하려고하면 오류가 발생합니다. "데이터 디렉토리가 알 수없는 변수 postgresql ***에 등록되었지만 비어 있거나 인식 가능한 데이터 디렉토리가 아닙니다." – Owen

+0

@Owen 업데이트 대답은 다음 단계를 따르십시오. –

+0

단계를 수행했지만 자습서가있는 서버가 없습니다. 또한 튜토리얼에서 비밀번호를 묻지 않습니다. 이걸 어떻게 설정해야할지 모르겠다. – Owen