【问题标题】:PostgreSQL, SQL Shell(psql) psql: error: could not connect to server: fe_sendauth: no password suppliedPostgreSQL,SQL Shell(psql)psql:错误:无法连接到服务器:fe_sendauth:未提供密码
【发布时间】:2020-06-12 21:09:34
【问题描述】:

SQL shell(psql) 在提示用户 postgress psql 的密码时抛出此错误:错误:无法连接到服务器:fe_sendauth:未提供密码

试过CMD
C:\Users\myuser>psql 用户 myuser 的密码: psql:错误:无法连接到服务器:fe_sendauth:未提供密码

C:\Users\myuser>psql -U postgres 用户 postgres 的密码: psql:错误:无法连接到服务器:致命:用户“postgres”的密码验证失败

找到这个 1. 回答:也许是这个问题 pgpass.conf 文件需要将它放到 PostgreSQL 服务器而不是 pgAdmin(客户端的目录)??但是在资源管理器中找不到这样的文件

pgAdmin 4 工作得很好,问题在于 psql shell

我是WIN 10,有没有人遇到同样的问题,怎么解决?

PS:我设法通过将 pg_hba.config 文件设置为来工作 psql shell

托管所有 127.0.0.1/32 md5

对于 ip4 和 ip6,我在 md5 中设置了信任并重新加载了 Postgress 服务,但是当我在将新密码设置为 md5 后恢复时,同样的问题和错误

psql:错误:无法连接到服务器:fe_sendauth:未提供密码

pgAdmin 4 仍然有效

【问题讨论】:

    标签: sql postgresql passwords psql


    【解决方案1】:

    我已经安装和卸载了很多次,我已经设法在下图中得到了想要的结果......

    1. 安装postgres 无需更改任何内容,只需输入新密码并通过在 Windows 搜索菜单中输入“psql”打开 sql shell。
    2. 在 SQL shell 中,一直按 Enter 直到它提示您输入 您在安装程序上创建的密码
    3. 在此处输入您的密码,即使它看起来不像 键入并在完成后按 Enter。

    它应该看起来像......

    Server [localhost]:
    Database [postgres]:
    Port [5432]:
    Username [postgres]:
    Password for user postgres:
    psql (12.2)
    
    WARNING: Console code page (850) differs from Windows code page (1252)
    8-bit characters might not work correctly. See psql reference
    page "Notes for Windows users" for details.
    Type "help" for help.
    
    postgres=# 
    
    1. 从此链接pgadmin安装pgadmin,从psql输入密码 然后您应该会看到以下内容...

    1. 单击左上角的服务器数据库图标并添加您在 psql 中输入的密码。
    2. 创建数据库并获取列表。

      postgres=# CREATE DATABASE your_database_name OWNER postgres; #Click enter here
      CREATE DATABASE #result
      postgres=# \l #to get the below datbase list
      

    1. 回到pg admin,刷新浏览器,点击服务器图标。

    注意:如果您需要卸载/重新安装,您需要手动删除安装 Postgres 和 pgadmin 的文件夹。即使从系统设置卸载后也是如此。出于某种原因,即使您选择了该选项,Postgres 文件夹也不会完全删除。

    【讨论】:

      猜你喜欢
      • 2015-10-17
      • 2013-05-19
      • 2014-10-22
      • 2020-12-14
      • 1970-01-01
      • 2012-09-10
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      相关资源
      最近更新 更多