严重:用户“ postgres”的密码身份验证失败(带有pgAdmin 4的PostgreSQL 11) [英] FATAL: password authentication failed for user "postgres" (postgresql 11 with pgAdmin 4)

查看:1722
本文介绍了严重:用户“ postgres”的密码身份验证失败(带有pgAdmin 4的PostgreSQL 11)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装了Postgresql 11,在安装过程中,没有步骤输入Postgres的密码和用户名。现在,在pgAdmin 4中,我想将数据库连接到服务器,并要求我输入密码,但我没有将其放在首位。
任何人都知道发生了什么事。谢谢!

解决方案

您可以通过 pgAdmin->访问pgpass.conf。文件->打开pgpass.conf





这将在窗口底部为您提供 pgpass.conf 的路径(官方文档)。



如果您随后打开此文件并根据自己的喜好对其进行编辑。 / p>

如果这不起作用,您可以:




  • 找到pg_hba。 conf,通常在C:\Program Files\PostgreSQL\9.1\data\pg_hba.conf

  • 如有必要,请对其设置权限,以便您可以对其进行修改;您的用户帐户可能无法执行此操作,直到您使用属性对话框中的安全性选项卡通过使用管理员替代来赋予自己该权利。

  • 或者,在开始菜单中找到notepad / notepad ++,右键单击,选择以管理员身份运行,然后使用File-> Open那样打开pg_hba.conf。

  • 编辑它以将主机 127.0.0.1/32上的用户 postgres的主机行设置为信任。您可以添加该行(如果该行不存在);只需插入:



托管所有postgres 127.0.0.1/32信任



在任何其他行之前。 (您可以忽略注释,以#开头的行。)。




  • 从服务控制面板重新启动PostgreSQL服务(开始-> run-> services.msc)


  • 使用psql或pgAdmin4或您喜欢的任何内容进行连接


  • 运行 ALTER USER postgres PASSWORD'fooBarEatsBarFoodBareFoot'

  • 删除添加到pg_hba.conf的行或将其更改回

  • 再次重新启动PostgreSQL。


I recently installed Postgresql 11, during the installation, there's no step to put password and username for Postgres. Now in pgAdmin 4, I wanted to connect the database to server and it's asking me to input password, and I haven't put any in the first place. Any one knows what's going on. Thank you!

解决方案

You could access your pgpass.conf via pgAdmin -> Files -> open pgpass.conf

That will give you the path of pgpass.conf at the bottom of the window (official documentation).

If you then open this file and edit it to your liking.

If that doesn't work, you can:

  • Find your pg_hba.conf, usually in C:\Program Files\PostgreSQL\9.1\data\pg_hba.conf
  • If necessary, set the permissions on it so that you can modify it; your user account might not be able to do so until you use the security tab in the properties dialog to give yourself that right by using an admin override.
  • Alternately, find notepad / notepad++ in your start menu, right click, choose "Run as administrator", then use File->Open to open pg_hba.conf that way.
  • Edit it to set the "host" line for user "postgres" on host "127.0.0.1/32" to "trust". You can add the line if it isn't there; just insert:

host all postgres 127.0.0.1/32 trust

before any other lines. (You can ignore comments, lines beginning with #).

  • Restart the PostgreSQL service from the Services control panel (start->run->services.msc)

  • connect using psql or pgAdmin4 or whatever you prefer

  • and run ALTER USER postgres PASSWORD 'fooBarEatsBarFoodBareFoot'
  • remove the line you added to pg_hba.conf or change it back
  • restart PostgreSQL again.

这篇关于严重:用户“ postgres”的密码身份验证失败(带有pgAdmin 4的PostgreSQL 11)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆