我在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)
如您所见,您看不到Superuser
和数据库 strapi
下matt
用户名。 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
.这通常意味着该端口被防火墙阻止。检查您的云提供商防火墙设置和iptables
在你的 Linux 盒子里,以防你已经安装了它。
如果权限有问题,则错误消息将是其他内容。
关于database - 无法连接到 ubuntu 上的 postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66608945/