postgreSQL 用户密码验证失败

mat*_*arb 3 windows-10 pgadmin-4 postgresql-14

我正在学习完整的 WebDev 课程,并且在这个问题上遇到了很大的困难。我已经为 Windows 10 安装了 postgreSQL 14.2,讲师说 pgAdmin4 会一起安装,但事实并非如此,所以我单独安装了 pgAdmin4。我已经设置了所有内容并创建了一个测试数据库(称为“test”),还有一个表,所有内容都通过 Windows Powershell 命令行按照课程说明进行。现在,当我尝试通过 PowerShell 命令访问此数据库psql 'test'并输入操作系统用户请求的密码时,我收到致命错误,如下所示:

PS C:\Users\theu_\desktop> psql 'test'
Password for user theu_:
psql: error: connection to server at "localhost" (::1), port 5432 failed: FATAL:  password authentication failed for user "theu_"
Run Code Online (Sandbox Code Playgroud)

我已经尝试过我的操作系统用户名密码和 postgreSQL 密码,但都不起作用。我错过了什么或做错了什么?

提前致谢

Nod*_*ere 22

尝试通过psql -U postgres在 cmd 中使用来访问 postgres,postgres 是 postgres 本身的超级用户的名称(如果您进行了基本安装) - 而 windows 可能会尝试使用您的 windows 名称来访问 postgres。

您还应该能够使用 SQL Shell 访问数据库,而无需指定用户。