简体   繁体   English

无法使用山狮连接到Postgres服务器

[英]can't connect to postgres server with mountain lion

Need help after scouting all those issues with postgres and mac 10.8 搜寻Postgres和Mac 10.8的所有问题后需要帮助

I installed pg through homebrew (tried with heroku app also but no luck) 我通过自制软件安装了pg(也尝试过heroku应用,但没有运气)

which psql --> /usr/local/bin/psql
psql --version --> psql (PostgreSQL) 9.2.4

When starting rails server I get Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? 启动Rails服务器时,我得到服务器Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

When I do pg_ctl -D /usr/local/var/postgres -l logfile start I get server starting 当我执行pg_ctl -D /usr/local/var/postgres -l logfile start我会pg_ctl -D /usr/local/var/postgres -l logfile start server starting

When I run psql I get Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? 当我运行psql我得到Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

Any idea? 任何想法?

Whatever is wrong with my setup I ended adding host: localhost to my database.yml and it did the trick. 无论我的设置有什么问题,我都结束了将host: localhost添加到我的database.yml ,并成功了。 Too much time wasted so it will remain as is for now. 浪费了太多时间,因此现在仍然可以保留。 Thanks for your help. 谢谢你的帮助。

Do you have the user "postgres" in the system? 系统中是否有用户“ postgres”?

I don't know homebrew but maybe you need: 我不知道自制酒,但也许您需要:

/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

Also postgres user must have write permissions on logs files. 另外,postgres用户必须对日志文件具有写权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM