我有问题连接到postgres(使用hombrew版本9.4.4安装)。我之前已经能够成功连接。我认为唯一可以改变的是我安装了PHP 5.5。
我尝试启动服务器:
postgres -D /usr/local/var/postgres
LOG: unrecognized configuration parameter "dynamic_shared_memory_type"
in file "/usr/local/var/postgres/postgresql.conf" line 130
FATAL: configuration file "/usr/local/var/postgres/postgresql.conf"
contains errors
服务器日志返回相同的错误。下面是抛出错误的postgresql.conf文件的内容:
dynamic_shared_memory_type = posix # the default is the first option
# supported by the operating system:
# posix
# sysv
# windows
# mmap
# use none to disable dynamic shared memory
在尝试排除故障时,我注释掉了dynamic_shared_memory_type,得到了这个错误:
FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 9.4,
which is not compatible with this version 9.3.5.
然而,运行brew info postgres,我被告知我的版本是9.4.4。
命令:
$ postgres -D /usr/local/var/postgres
启动在$PATH
中最先出现的postgres
二进制文件。
在您的情况下,它恰好是postgres 9.3.5,可能来自以前的安装和/或其他安装程序。该版本不能与9.4版本的postgresql.conf一起使用。x是因为新的dynamic_shared_memory_type
参数,但更重要的是它不能与9.4工作。(数据格式在主要版本之间不兼容)。
命令which postgres
将告诉它在磁盘上的位置。
通常,brew的postgres
二进制文件应该位于/usr/local/bin/postgres
中。为避免与其他postgres冲突,请使用绝对路径而不是相对路径启动它:
$ /usr/local/bin/postgres -D /usr/local/var/postgres
和
$ /usr/local/bin/postgres -v
只检查版本号
在Mac OS X上,有相当多不同的安装程序,如下所示:
https://wiki.postgresql.org/wiki/Installers/Mac_OS_X
具有不同的磁盘布局。在Mac上尝试不同的安装程序并最终并行安装多个postgres是很正常的。