postgresql - 创建 : could not connect to database template1: FATAL: password authentication failed for user

标签 postgresql terminal ruby-on-rails-4 homebrew postgresql-9.2

通过 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/

相关文章:

sql - 通过计数获得中位数

hadoop - `find` 中是否有 `hadoop` 命令的等价物?

ruby-on-rails - Rails 4 事件记录验证 - 有条件地验证 4 个属性的相互依赖的存在

vim - 终端编码在 vim 中如何工作?

delphi - 启动终端程序,但在终端关闭后让它继续运行 - Lazarus 或 Delphi

mysql - Rails-使用模型文件中的方法保存时丢失数据

ruby-on-rails - 包含 redirect_to 的测试因 rspec 而失败,但应用程序按预期工作。 Michael Hartl 书的第 9.6.6 章 (v 4.0)

postgresql - Heroku 页面 :push psql: FATAL: password authentication failed for user

postgresql - 如何打破postgresql中的连接池?

mysql - 具有唯一约束的原子多行更新