从Windows PGadmin访问WSL postgresql服务器。

问题描述 投票:3回答:1

我在windows下的WSL Ubuntu中运行postgresql。一切都已就绪,我的数据已加载,我希望通过一些图形界面来访问数据库。我想使用pgadmin4。

是否可以通过在windows下安装pgadmin4来实现?我在windows上安装了pgadmin4,并尝试通过localhost在GUI中用传统的方式连接,但没有得到连接。我想这里可能有一种特殊的方法。

postgresql windows-subsystem-for-linux pgadmin-4
1个回答
0
投票

不需要特别的方式,你应该可以获得一个连接。就像你的开发http端口暴露在Windows的浏览器上一样,你的db端口也应该暴露。

我不得不手动添加localhost到pg admin,这有点奇怪。

确保你的db服务在Ubuntu上是正常运行的,有时候db服务会无缘无故被杀掉。

要看看你的Postgres服务是否启动了。

sudo service postgres status

如果没有,启动服务。

sudo service postgres start
© www.soinside.com 2019 - 2024. All rights reserved.