我在Postgresql 10中创建了一个新数据库和一个用户,分别命名为'reportingdashboardproject'和'repadmin'。我使用以下命令创建和授予特权:
postgres=# create database reportingdashboardproject;
postgres=# create user repadmin with encrypted password '<password>';
postgres=# grant all privileges on database reportingdashboardproject to repadmin;
psql=# grant all privileges on database reportingdashboardproject to repadmin ;
当尝试使用上述方法通过数据库连接URI启动Express.js服务器时,我得到了响应:
FATAL password authentication failed for user repadmin
以下是相关代码:
const dbConfig = {
operatorsAliases: false
};
const Sequelize = require("sequelize");
const sequelize = new Sequelize('postgres://postgres:postgres@localhost:5432/reportingdashboardproject', dbConfig); //also tried using repadmin:<password>, failed.
尝试通过DBeaver(端口5432)打开连接时遇到相同的错误
然后我尝试使用用户:postgres和密码:postgres或为空。这些组合都不起作用。在尝试空密码时,我看到了以下内容:
The server requested password based authentication, but no password was provided
部分Db列表(也有template0和template1):
postgres=# \l
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------------------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
reportingdashboardproject | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
用户列表:
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
repadmin | | {}
我也尝试过显式授予超级用户特权:
postgres=# grant all privileges on database reportingdashboardproject to postgres;
GRANT
可能是某种sudo /权限问题吗?
postgres=# \q
could not save history to file "/opt/PostgreSQL/10/.psql_history": Permission denied
不确定接下来要解决的问题。感谢您的指导。