node.js - 如何连接到 localhost PostgreSQL 数据库?
问题描述
尝试通过 localhost 连接到我的 postgres 数据库时出现授权错误。我可以正常登录sudo -u postgres psql
。尝试通过我的 Express 应用程序(同时使用 Sequelize 和 node-postgres)进行连接时,出现错误。
错误:
error: password authentication failed for user: "postgres"
.env:
PGUSER="postgres"
PGHOST=""
PGPASSWORD=""
PGDATABASE=""
PGPORT=""
续集配置:
const sequelize = new Sequelize('postgres://postgres@localhost:5432/test', { ... });
我已经编辑了我的 pg_hba.conf 文件,并接受了所有 localhost 连接:
local all all _BLANK_ trust
解决方案
推荐阅读
- reactjs - JSON数据进入React Js中的请求参数(而不是字符串)
- python - 如何将python包分发给小型企业
- kubernetes - `secret` 如何保护 Kubernetes 中的敏感信息
- java - 奇数序列替换为计数
- ionic-framework - 离子缺失脚本:离子:构建
- html - Python网页抓取使用BeautifulSoup,如何合并两个
文本到列表的一个元素中
- django - Django Sql:没有这样的功能:十进制
- r - 给定它们的一些名称,按顺序添加列 data.frame R
- database - 从表主删除数据具有多对多关系
- python - 如何在 Windows x64 位 Python 3.6.x 上正确安装 TensorFlow