使database.yml文件在OSX上的Rails中工作 [英] Making the database.yml file work in Rails on OSX
本文介绍了使database.yml文件在OSX上的Rails中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道在osx上使用postgres有点困难,因为它运行着自己的版本,因此要psql到它,您需要像这样提供主机名
I understand that using postgres on osx is a little difficult because it has its own version running, and so in order to psql to it you need to supply the host name like so
psql -h本地主机mydatabasename -U me
psql -h localhost mydatabasename -U me
但是,如何为您的database.yml文件做到这一点,以达到所有的好处。
However how do you do this for your database.yml file for all the rail loveliness.
如果尝试连接
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"?
任何有关如何提供信息或配置osx的想法都不太吸引人!!
Any ideas on how to supply the information or config osx not to suck so much?!
推荐答案
如果您能够使用 psql
在本地主机上连接到Postgres,则只需添加:
If you're able to connect to Postgres on localhost with psql
, then just add:
host: localhost
到 database.yml
这篇关于使database.yml文件在OSX上的Rails中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文