2012-03-24 4 views
8

पर रेलवे में डेटाबेस.आईएमएल फ़ाइल काम करना मुझे लगता है कि ओएसएक्स पर पोस्टग्रेस का उपयोग करना थोड़ा मुश्किल है क्योंकि इसका अपना संस्करण चल रहा है, और इसलिए इसे psql करने के लिए आपको होस्ट नाम की आपूर्ति करने की आवश्यकता हैओएसएक्स

psql -h स्थानीय होस्ट mydatabasename यू मुझे

हालांकि कैसे आप सभी रेल सुंदरता के लिए अपने database.yml फ़ाइल के लिए ऐसा करते हैं।

आप

development: 
    adapter: postgresql 
    username: me 
    database: mydatabasename 

साथ कनेक्ट करने का प्रयास आप क्लासिक

Couldn't create database for {"adapter"=>"postgresql", "username"=>"me", "database"=>"mydatabasename"} 
could not connect to server: No such file or directory 
    Is the server running locally and accepting 
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 

कोई कैसे जानकारी या config OSX इतना चूसना करने के लिए नहीं की आपूर्ति करने पर विचार प्राप्त ?!

उत्तर

19

आप psql साथ स्थानीय होस्ट पर Postgres से कनेक्ट करने के लिए, तो सक्षम हैं, तो सिर्फ जोड़ें:

host: localhost 

database.yml

+0

आपने मेरा दिन बचाया – yujingz

5

मेरे काम के विन्यास के लिए इस प्रकार है:

development: 
    adapter: postgresql 
    database: database_name 
    host: localhost 
    username: user_name 
    pool: 5 
    timeout: 5000 

तो मुझे लगता है कि आपको होस्ट जोड़ने की आवश्यकता है: localhost।

0
development: 
    adapter: postgresql 
    encoding: utf8 
    database: name 
    username: hading 
    password: my_db_password 
    host: localhost # not mandatory 
    pool: 5 # not mandatory 
    timeout: 5000 # not mandatory