在Ubuntu上多次安装Postgres

时间:2018-07-19 00:08:36

标签: postgresql ubuntu ubuntu-12.04 postgresql-9.1 postgresql-10

这是我第一次在Ubuntu 12.04LTS上设置多个Postgres postgres服务器。 (我知道有多个版本是个坏主意,但是在迁移并杀死旧实例之前,需要先检查一下新安装)

  • 原始Postgres V9.1使用捆绑的apt-get install安装。 (端口:5432)
  • 新的Postgres V10通过EnterpriseDB软件包安装。 (端口:5433)

我能够为V9.1使用标准实用程序,例如psql,pg_dump等。但是,我无法访问V10的psql。相反,我收到此错误消息(注意端口不正确):

/opt/PostgreSQL/10/bin$ ./psqlpsql.bin: 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"?

我希望能够通过使用psql进行理想的管理。

我通常使用Python连接到数据库,并且能够在端口5433上创建到新实例的SQLAlchemy连接。我也可以查询pg_catalog和information_schema。

提前谢谢!

1 个答案:

答案 0 :(得分:0)

postgres的默认端口是5432。 因此,如果要访问V10的psql,请使用以下命令:

export PATH=/opt/PostgreSQL/10/bin:$PATH psql -p 5433