通过 Homebrew 安装了 Postgresql。我想在解压缩“.tar”后创建一个新数据库。但是我有这个问题。
Michael-Adelekes-MacBook:wikiful madeleke13$ sudo su postgres -c 'createuser-P--superuser madeleke13'
bash: createuser-P--superuser: command not found
Michael-Adelekes-MacBook:wikiful madeleke13$ sudo su postgres -c 'createuser-P-superuser madeleke13'
bash: createuser-P-superuser: command not found
Michael-Adelekes-MacBook:wikiful madeleke13$ sudo su postgres -c 'createuser -P --superuser madelek13'
Password: Enter password for new role: Enter it again:
Michael-Adelekes-MacBook:wikiful madeleke13$ createdb -T template0
newdbPassword:
Password:createdb: could not connect to database template1: FATAL: password authentication failed for user "madeleke13"
Michael-Adelekes-MacBook:wikiful madeleke13$
我不明白为什么我以前没有问题却无法验证我的用户名。
最佳答案
问题是此命令中的用户名:sudo su postgres -c 'createuser -P --superuser madelek13'
请注意用户名与用户帐户名不同:madeleke13。提供给 createuser 命令的用户名中缺少“e”,因此身份验证失败。
关于postgresql - 创建 : could not connect to database template1: FATAL: password authentication failed for user,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20692100/