在 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”命令以获取数据库角色并确认为超级用户创建的“角色名称”。因此,对于遇到同样问题的其他人,我建议首先尝试这种方法。 下:注册 - 服务器, 更新常规选项卡 > '名称' = 'localhost', 然后更新“连接”选项卡>“主机名”=“localhost”,“用户名”=“与超级用户的数据库角色匹配”
如果您正在运行本地服务器,这会有所帮助。我遇到了类似的问题,并通过使用另一个名为 postgresapp 的客户端应用程序来启动我的本地 pg 服务器来解决它。这里:https://postgresapp.com/
请确保默认端口
5432
空闲;否则选择另一个端口;
已解决:
我删除了数据目录
/Users/jonathan/Library/Application Support/Postgres/var-14
并重新开始。
@fotiecodes 提供的解决方案对我有用。更具体地说:
docker stop <container-id>
sudo lsof -i:5432 (default port)
sudo kill <PID>
然后只需启动容器并通过 PgAdmin4 连接到它。