加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

macos – 尝试在OSX上设置postgres

发布时间:2020-12-13 16:13:17 所属栏目:百科 来源:网络整理
导读:我试图在我的mac(10.7 Lion)上为本地的rails应用程序设置postgres. 我安装了postgresapp并启动它,我现在在状态栏中有一只大象告诉我postgres正在运行. 我可以通过以下方式达到: psql -h localhost 但是,当我只是运行psql时,我收到此错误: psql: could not
我试图在我的mac(10.7 Lion)上为本地的rails应用程序设置postgres.

我安装了postgresapp并启动它,我现在在状态栏中有一只大象告诉我postgres正在运行.

我可以通过以下方式达到:

psql -h localhost

但是,当我只是运行psql时,我收到此错误:

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”?

我把它说:

PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"

在?/ .bashrc中打开一个新终端.但没有骰子.

当我运行哪个psql时我得到/usr/bin/psql

不确定该怎么做..我对unix系统还是个新手.我应该将/usr/bin/psql符号链接到/Applications/Postgres.app/Contents/MacOS/bin/psql吗?

我在运行Mountain Lion的新MacBook Pro上遇到了类似的问题.我下载了 PostgresApp,当我启动rails时,我收到以下错误:
`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文件中明确定义主机和端口,如下所示:

development:
  adapter: postgresql
  encoding: unicode
  database: my_app_development
  pool: 5
  username: tony
  password: stark    
  host: localhost
  port: 5432

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读