我在pgsql中创建了一个没有密码的新用户。但是当我尝试为该用户创建数据库时,它提示输入密码。
>createuser -d -S -R -U postgres test1
Password:
>createdb -U test1 db1
Password:
我尝试了超级用户密码,但是出现了以下错误:
createdb: could not connect to database template1: FATAL: password authentication failed for user "test1"
请帮忙,谢谢。
需要翻译的内容已完成。
-P
选项实际上是--pwprompt
的快捷方式,这与 OP 想要的相反,它会使用提示框来询问密码。根据文档[1]:“如果提供了该选项,则 createuser 将提示输入新用户的密码。如果您不打算使用密码身份验证,则无需此操作。”[1] https://www.postgresql.org/docs/9.6/app-createuser.html - Eduardo