作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以我在我的 Mac 上安装了 Postgresql,每当我运行 psql
或 createdb cool_database_name
之类的东西时,我都会收到以下错误。
psql: 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"?
所以我遵循不同的解决方案。我重新安装了postgresql 无济于事。我转到 postgresql.conf` 并将其更改为
#port = 5432 # (change requires restart)
#max_connections = 20 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directory = '/var/pgsql_socket' # (change requires restart)
#unix_socket_group = '' # (change requires restart)
#unix_socket_permissions = 0777 # begin with 0 to use octal notation
还是没有。我运行诸如
之类的命令ls -lA /var/run/postgresql
提示文件或目录不存在
我还查看了 pg_hba.conf
文件,但一切正常
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local replication jason trust
#host replication jason 127.0.0.1/32 trust
#host replication jason ::1/128 trust
当我运行 psql -h localhost
时,我得到了
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (fe80::1) and accepting
TCP/IP connections on port 5432?
我不知道如何解决这个问题。任何帮助,将不胜感激。
最佳答案
问题是 Mac OS 附带了 PostgreSQL
$ `which psql` --version
psql (PostgreSQL) 9.1.4
contains support for command-line editing
您需要像这样更改 PATH:
export PATH="path_to_bin_folder_of_your_new_postgres_install:$PATH"
例如,对于 Postgres.app:
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
这可能有用:http://blog.ringerc.id.au/2012/09/postgresql-packaging-on-mac-os-x-is-mess.html
关于macos - 安装后无法连接到 Mac OS X 上的 Postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14971223/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!