change pgsql port

Postgresql

Postgresql Problem Overview


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?

Postgresql Solutions


Solution 1 - Postgresql

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

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/

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

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

Solution 2 - Postgresql

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBhavikView Question on Stackoverflow
Solution 1 - PostgresqlNeallView Answer on Stackoverflow
Solution 2 - PostgresqlFrank HeikensView Answer on Stackoverflow