Dav*_*sby 4 postgresql homebrew
我在 macOS 上使用 Homebrew 安装了 Postgres。我可以启动一个 Postgres 服务器,它使用命令侦听默认端口 5432 brew services start postgres
,但我希望它使用不同的端口。
使用我的 Homebrew Postgres 安装,如何启动侦听另一个端口的 Postgres 服务器?
对于持久修复,您可以更改配置文件:
1.确定brew安装Postgres的位置
brew info postgresql@<your_version>
我机器上的位置是/usr/local/var/postgresql@14/postgresql.conf
2. 导航到那里并打开 postgresql.conf
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = 'localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5555 # (change requires restart)
Run Code Online (Sandbox Code Playgroud)
然后您可以在重新启动 postgresql 之前设置端口和地址。
3.重启postgresql
brew services restart postgresql
归档时间: |
|
查看次数: |
6081 次 |
最近记录: |