postgresql 更改 pgsql 端口

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/187438/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 22:09:42  来源:igfitidea点击:

change pgsql port

postgresql

提问by Bhavik

I have currently an installed pgsql instance that is running on port 1486. I want to change this port to 5433, how should I proceed for this?

我目前有一个在端口上运行的已安装 pgsql 实例1486。我想将此端口更改为5433,我应该如何进行此操作?

回答by Neall

There should be a line in your postgresql.conffile that says:

您的postgresql.conf文件中应该有一行说:

port = 1486

Change that.

改变那个。

The location of the file can vary depending on your install options. On Debian-based distros it is /etc/postgresql/8.3/main/

该文件的位置可能因您的安装选项而异。在基于 Debian 的发行版上,它是/etc/postgresql/8.3/main/

On Windows it is C:\Program Files\PostgreSQL\9.3\data

在 Windows 上是 C:\Program Files\PostgreSQL\9.3\data

Don't forget to sudo service postgresql restartfor changes to take effect.

不要忘记sudo service postgresql restart让更改生效。

回答by Frank Heikens

You can also change the port when starting up:

您还可以在启动时更改端口:

$ pg_ctl -o "-F -p 5433" start

Or

或者

$ postgres -p 5433

More about this in the manual.

手册中有更多关于这方面的信息。