[英]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
選項卡並填寫localhost
、 user
、 database name
和user password
區域,然后單擊connect
。
可悲的是,這需要數周時間才能做到這一點:/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.