pgAdmin 4:为什么我无法访问服务器?



在pgAdmin 4中,当我尝试点击PostgreSQL 14服务器(或任何其他服务器(时,我会收到一条我不理解的错误消息:

connection to server at "localhost" (::1), port 5432 failed: could not initiate
GSSAPI security context: The operation or option is not available: Credential
for asked mech-type mech not found in the credential handle connection to
server at "localhost" (::1), port 5432 failed: FATAL: role "postgres" does not
exist

该网站为Postgres应用程序生成了一个安装程序,它提供了

Could not start PostgreSQL server. pg_ctl: Could not start server. Examine the log output.

日志输出为:

2022-07-29 10:41:10.111 EDT [44185] LOG:  starting PostgreSQL 14.4 on aarch64-apple-darwin20.6.0, compiled by Apple clang version 12.0.5 (clang-1205.0.22.9), 64-bit
2022-07-29 10:41:10.113 EDT [44185] LOG:  listening on IPv6 address "::1", port 5432
2022-07-29 10:41:10.113 EDT [44185] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2022-07-29 10:41:10.114 EDT [44185] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-07-29 10:41:10.119 EDT [44186] LOG:  database system was interrupted; last known up at 2022-06-01 12:45:50 EDT
2022-07-29 10:41:10.198 EDT [44186] LOG:  invalid primary checkpoint record
2022-07-29 10:41:10.198 EDT [44186] PANIC:  could not locate a valid checkpoint record
2022-07-29 10:41:10.198 EDT [44185] LOG:  startup process (PID 44186) was terminated by signal 6: Abort trap: 6
2022-07-29 10:41:10.198 EDT [44185] LOG:  aborting startup due to startup process failure
2022-07-29 10:41:10.199 EDT [44185] LOG:  database system is shut down

我遇到了同样的问题,发现问题是默认的"用户名";当连接pgAdmin 4中的服务器时,需要更新以匹配我设置postgres时创建的超级用户。在psql中运行'\du'命令以获取数据库角色并确认"角色名称"为超级用户创建的。因此,对于其他有同样问题的人,我建议首先尝试这种方法。下:Register-Server,更新"常规"选项卡>'名称'='localhost',然后更新"连接"选项卡>'主机名'='localhost',用户名'='与超级用户的数据库角色匹配'

如果您正在运行本地服务器,这会有所帮助。我遇到了类似的问题,并通过使用另一个名为postgresapp的客户端应用程序来启动我的本地pg服务器来解决它。此处:https://postgresapp.com/

请确保默认端口5432空闲;否则选择另一个端口;

已解决:

我删除了数据目录/Users/jonathan/Library/Application Support/Postgres/var-14并重新开始。

最新更新