![](/img/trans.png)
[英]using hibernate: psql: could not connect to server: Connection refused
[英]could not connect to server: Connection refused (0x0000274D/10061) PostgreSQL
我使用 AWS 並想連接 postgresql 但我有問題
Unable to connect to server:
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "xx.xxx.x.x" and accepting
TCP/IP connections on port 5432?
在服務器停留 ubuntu 18.04 上,我安裝了 postgres 使用了這個命令:
sudo sh -c 'echo "local all all trust" >> /etc/postgresql/12/main/bg_hba.conf'
sudo sh -c 'echo "host all all 127.0.0.1/32 trust" >> /etc/postgresql/12/main/bg_hba.conf'
sudo sh -c 'echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/12/main/bg_hba.conf'
sudo nano /etc/postgresql/12/main/postgresql.conf
listen_addresses = '*'
sudo service postgresql restart
是的,我刪除了“#”
ubuntu@ip-xxxxxxxxxx:~$ sudo netstat -ltpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6462/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 629/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1040/sshd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 20516/postgres
tcp 0 0 127.0.0.1:5433 0.0.0.0:* LISTEN 20539/postgres
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 16863/master
tcp 0 0 0.0.0.0:5434 0.0.0.0:* LISTEN 20517/postgres
tcp6 0 0 :::80 :::* LISTEN 6462/nginx: master
tcp6 0 0 :::8080 :::* LISTEN 5975/java
tcp6 0 0 :::22 :::* LISTEN 1040/sshd
tcp6 0 0 :::25 :::* LISTEN 16863/master
tcp6 0 0 :::5434 :::* LISTEN 20517/postgres
從 pgAdmin4 連接 我做錯了什么? 感謝您回答我是否使用了我顯示的命令
ubuntu@ip-xxxxxxxx:~$ sudo -i -u postgres
postgres@ip-xxxxxxxx:~$ psql
psql (12.2 (Ubuntu 12.2-2.pgdg18.04+1), server 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1))
您是否驗證了 RDS 實例的安全組? RDS 實例是在公有子網還是私有子網中? 它是內部還是外部 RDS 實例。
但是,需要一些額外的網絡設置才能從提供的信息中准確識別它無法連接。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.