为什么postgres将计算机用户作为登录用户?

我正在尝试使用Postgresql数据库在系统上测试wal2json。我在postgresql.conf和pg_hba.conf文件中进行了更改,如以下链接所示:

https://github.com/eulerto/wal2json

但是当我尝试使用postgres命令创建测试插槽时,它给出了错误:

C:\Program Files\PostgreSQL\12\bin>pg_recvlogical -d mydatabase --slot test_slot --create-slot -P wal2json
Password:
pg_recvlogical: error: could not connect to server: FATAL:  password authentication failed for user "LENOVO"

这里有趣的是,我的postgres用户都不是LENOVO的名字。 LENOVO是我的笔记本电脑登录名。知道如何解决这个问题吗?

xinfeifei1 回答:为什么postgres将计算机用户作为登录用户?

这样做的原因是您没有在数据库连接字符串参数中指定用户名。 Linux pg_recvologic手册页说:

-U user
--username=user
User name to connect as. Defaults to current operating system user name.

您需要在连接字符串中添加数据库用户名。

本文链接:https://www.f2er.com/2584620.html

大家都在问