database - 无法连接到 ubuntu 上的 postgres
问题描述
我在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 框中安装它。
如果权限有问题,则错误消息将是其他内容。
推荐阅读
- angular - 如何将 PrimgNg 选中的复选框向下传递到子组件下拉列表?
- amazon-web-services - 如何为负载均衡器后面的 AWS EC2 实例上的所有传出流量分配唯一的域名/IP
- autodesk-forge - 在树视图中选择项目时的右键单击和左键单击行为 - 版本 6 与 7
- sql-server - 将 Decode Substr Oracle 查询转换为 SQL Server
- sql - Proc Sql 输出
- jquery - 如何在选择选项下将背景图像添加到选项
- node.js - 如何在 mongoose 中进行与 mysql 相同的子查询?
- c++ - 您将如何为 AVX2 和 AVX512 编写与功能无关的代码?
- django - media_root 文件夹中的图像不会显示在 Django 模板中
- sql - 两个内连接返回空结果