how to change postgresql listening port in windows

2019-02-01 22:56发布

问题:

How do i change the default listening port 5432 of postgresql to another number?

Another question,

What steps do i have do to allow remote r/w access to the database using python pyscopg2?

回答1:

Just change the setting in the file postgresql.conf (can be found in the data directory):

port = 5433             # (change requires restart)

Remote access can be given by changing pg_hba.conf, just add the ip-address. You also have to edit postgresql.conf:

listen_addresses = '*'