簡體   English   中英

無法連接到 ubuntu 上的 postgres

[英]Can't connect to postgres on ubuntu

我在dreamcompute(雲計算)上有一個ubuntu 20。

我創建了一個用戶和一個數據庫。 這是數據庫和用戶的列表(由於某種原因,我在matt用戶名下看不到數據庫)。

我進入: nano /etc/postgresql/13/main/postgresql.conf & nano /etc/postgresql/13/main/pg_hba.conf並做了整個'*''0.0.0.0/0'

postgres=# \l
                              List of databases
   Name    |  Owner   | Encoding | Collate |  Ctype  |   Access privileges
-----------+----------+----------+---------+---------+-----------------------
 postgres  | postgres | UTF8     | C.UTF-8 | C.UTF-8 |
 strapi    | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/postgres         +
           |          |          |         |         | postgres=CTc/postgres+
           |          |          |         |         | hossein=CTc/postgres
 template0 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
 template1 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
           |          |          |         |         | postgres=CTc/postgres
(4 rows)

如您所見,在matt用戶名下看不到Superuser和數據庫strapi

                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 matt      |                                                            | {}
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
 ubuntu    |                                                            | {}

我正在使用我夢想計算的ip address作為我的主機並使用我的數據庫和用戶名和密碼,但收到錯誤消息: connection attempt time out

在此處輸入圖像描述

有人可以告訴我為什么會這樣嗎? 我已經為此工作了 2 周,但我無法讓它工作。

錯誤信息是connection time out 這通常意味着該端口被防火牆阻止。 檢查您的 Linux 框中的雲提供商防火牆設置和iptables ,以防您已安裝它。

如果權限有問題,則錯誤消息將是其他內容。

正如上面提到的 ex4,我需要聯系我租用雲計算機的公司,但我仍然無法連接到數據庫。

我繞過它的方法是你可以ssh進入你的數據庫,然后作為localhost連接到你的數據庫,因為你是ssh進入你的雲計算機。

在 DBeaver 中,您有一個ssh選項卡,您可以連接,然后返回您的postgres選項卡並填寫localhostuserdatabase nameuser password區域,然后單擊connect

可悲的是,這需要數周時間才能做到這一點:/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM