小编Big*_*igJ的帖子

如何将 Postgresql 更改为侦听端口 5432?

我已经在我的机器上将 Postgresql 从 9.3 升级到 9.6(linux mint rafaella-so ubuntu 14.04)

由于以前的版本在 5432 上侦听,新版本在 5433 上侦听,但我想将其更改为 5432,以便之前的配置(rails、phppgadmin 等)与新的 postgres 服务器一起使用。

我已将 postgresql.conf 中的端口从 5433 更改为 5432 并重新启动了 postgres,但这不起作用:

$ sudo netstat -nltp |grep 5432     
$ sudo netstat -nltp | grep 5433
tcp        0      0 127.0.0.1:5433          0.0.0.0:*               LISTEN      25467/postgres 
Run Code Online (Sandbox Code Playgroud)

我还尝试设置环境变量并重新启动 postgres:

PGPORT=5432; export PGPORT
Run Code Online (Sandbox Code Playgroud)

再次,仍然在 5433 上收听,而在 5432 上什么也没有。

尝试连接给了我:

$ sudo -u postgres psql postgres 
psql: could not connect to server: No such file or directory
    Is the server running locally …
Run Code Online (Sandbox Code Playgroud)

postgresql postgresql-9.3 postgresql-9.6

8
推荐指数
1
解决办法
2万
查看次数