macos – 为什么我不能在将其作为服务运行时访问postgres?
当我尝试通过webapp访问postgres,或用psql -d template1打开postgres
shell时,我收到一个错误.
(*我已经阅读了很多有关此错误的SO主题,但推荐的解决方案并未解决此问题) 将postgres作为服务启动: brew services restart postgresql
在终端中手动运行postgres: 我可以通过在终端窗口中运行来完成所有工作,但我更喜欢在后台运行它. postgres -D /usr/local/var/postgres9.6.3 集群: 我在/usr/local/var中有3个数据库集群,但我想使用postgres9.6.3 / postgres postgres9.5/ postgres9.6.3/ 哪一个: 哪个psql返回/usr/local/bin / psql 路径: echo $PATH返回/usr/local/bin和/usr/local/var(已添加) 其他推荐解决方案 很多人都可以通过删除/postgres/postmaster.pid来解决这个问题,但这个文件对我来说并不存在. UPDATE 运行ps -ef | grep postgres,仅输出, 501 2135 1530 0 12:08pm ttys002 0:00.00 grep postgres 使用brew servies重新启动postgres后,/usr/local/var / log中的postgres.log包含, FATAL: database files are incompatible with server DETAIL: The data directory was initialized by PostgreSQL version 9.5,which is not compatible with this version 9.6.3. 解决方法
如果要将9.5数据与9.6服务器一起使用.你必须运行:
> pg_upgrade(here)或 如果您选择第一个选项,则无需进一步的步骤 – 您的默认版本为9.6,它将与现有数据目录一起使用. 在运行pg_upgrade之前,请复制data_directory (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |