我有一个旧项目,我想重新进入,但我无法进入postgres.跑步sudo -u postgres psql给了我:
Error: No existing local cluster is suitable as a default target.
Please see man pg_wrapper(1) how to specify one.
Run Code Online (Sandbox Code Playgroud)
我想知道这是否是因为我几个月前将postgres升级到版本9.4.这是我的输出dpkg --get-selections |grep postgres:
postgresql install
postgresql-9.3 install
postgresql-9.4 install
postgresql-client-9.3 install
postgresql-client-9.4 install
postgresql-client-common install
postgresql-common install
postgresql-contrib install
postgresql-contrib-9.3 install
postgresql-contrib-9.4 install
postgresql-server-dev-9.3 install
Run Code Online (Sandbox Code Playgroud)
这些是我目前的集群来自pg_lsclusters:
Ver Cluster Port Status Owner Data directory Log file
9.4 apps 5434 online postgres /var/lib/postgresql/9.4/apps /var/log/postgresql/postgresql-9.4-apps.log
9.4 main 5433 online postgres /var/lib/postgresql/9.4/main /var/log/postgresql/postgresql-9.4-main.log
Run Code Online (Sandbox Code Playgroud)
我能做些什么才能再次访问postgres?谷歌搜索没有太大的帮助.
因为没有你的集群监听的默认端口上5432,psql(这实际上是一个链接pg_wrapper)不知道哪一个应该是“默认”。
您可以psql --cluster 9.4/apps [other arguments]用来访问第一个集群,也可以访问第二个集群psql --cluster 9.4/main [other arguments]。
或者,将$PGCLUSTER环境变量定义为9.4/apps或9.4/main
这些来自pg_wrapper手册页的规则#2和#4(共8条)。
小智 5
如果你不关心你的默认集群是什么,只是想让事情像以前一样工作,只需指定你想要连接的端口
psql -p 5432
Run Code Online (Sandbox Code Playgroud)
并且 postgres 不会试图为你聪明并使用“集群”,无论是什么。
| 归档时间: |
|
| 查看次数: |
10084 次 |
| 最近记录: |