我试图在我的mac(10.7 Lion)上为本地的rails应用程序设置postgres.
我安装了postgresapp并启动它,我现在在状态栏中有一只大象告诉我postgres正在运行.@H_502_2@
我可以通过以下方式达到:@H_502_2@
psql -h localhost
但是,当我只是运行psql时,我收到此错误:@H_502_2@
psql: could not connect to server: Permission denied Is the server
running locally and accepting connections on Unix domain socket
“/var/pgsql_socket/.s.PGsql.5432”?@H_502_2@
我把它说:@H_502_2@
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
在〜/ .bashrc中打开一个新终端.但没有骰子.@H_502_2@
当我运行哪个psql时我得到/usr/bin/psql@H_502_2@
不确定该怎么做..我对unix系统还是个新手.我应该将/usr/bin/psql符号链接到/Applications/Postgres.app/Contents/MacOS/bin/psql吗?@H_502_2@
我在运行Mountain Lion的新MacBook Pro上遇到了类似的问题.我下载了
PostgresApp,当我启动rails时,我收到以下错误:
原文链接:https://www.f2er.com/postgresql/191861.html`initialize': could not connect to server: No such file or directory (PG::Error) Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGsql.5432"?
要解决这个问题,我必须在我的database.yml文件中明确定义主机和端口,如下所示:@H_502_2@
development: adapter: postgresql encoding: unicode database: my_app_development pool: 5 username: tony password: stark host: localhost port: 5432