Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres群集:用户的密码身份验证失败“;博士后&x201D;_Postgresql_Postgresql 9.3_Multiple Instances_Change Password - Fatal编程技术网

Postgresql Postgres群集:用户的密码身份验证失败“;博士后&x201D;

Postgresql Postgres群集:用户的密码身份验证失败“;博士后&x201D;,postgresql,postgresql-9.3,multiple-instances,change-password,Postgresql,Postgresql 9.3,Multiple Instances,Change Password,在我的Postgres中,服务器使用命令pg_createcluster在端口5433上侦听创建了一个集群。要为用户postgres设置密码,我遵循以下步骤: 编辑文件nano/etc/postgresql/9.3//pg_hba.conf 换线 托管所有127.0.0.1/32 md5 排队 托管所有127.0.0.1/32信任 使用以下命令更改密码 sudo-u postgres psql-h localhost-p 5433 postgres=#\password postgres 输入新

在我的Postgres中,服务器使用命令pg_createcluster在端口5433上侦听创建了一个集群。要为用户postgres设置密码,我遵循以下步骤:

  • 编辑文件nano/etc/postgresql/9.3//pg_hba.conf
  • 换线

    托管所有127.0.0.1/32 md5

    排队

    托管所有127.0.0.1/32信任

  • 使用以下命令更改密码
  • sudo-u postgres psql-h localhost-p 5433

    postgres=#\password postgres

    输入新密码:

    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    # su - postgres
    $ psql -U postgres -p 5433 -h localhost
    Password for user postgres:
    
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    # "local" is for Unix domain socket connections only
    local   all             all                                     trust
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            trust
    
    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    # su - postgres
    $ psql -U postgres -p 5433 -h localhost
    postgres=# \password postgres
    Enter new password:
    Enter it again:
    postgres=# \q
    $ exit
    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    
    请重新输入:

    postgres=#\q

  • 编辑文件nano/etc/postgresql/9.3//pg_hba.conf
  • 换线

    托管所有127.0.0.1/32信任

    排队

    托管所有127.0.0.1/32 md5

    显示无错误,但连接控制台和pgadmin3会触发错误:用户“postgres”的密码验证失败。默认情况下,在实例(main)中使用相同的进程,我可以成功连接

    我感谢任何帮助,因为我没有找到太多的文档来处理Postgres实例。
    提前感谢。

    首先,您需要重新加载配置,以便应用所有更改。连接端口可能未打开,而且您还没有清楚地共享
    本地连接的配置。这应该很好:

    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    
    # "local" is for Unix domain socket connections only
    local   all             all                                     trust
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    

    谢谢你的回复。我在pg_hba.conf中看到了您的响应配置:

    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    # "local" is for Unix domain socket connections only
    local   all             all                                     trust
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    
    更改密码:

    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    # su - postgres
    $ psql -U postgres -p 5433 -h localhost
    Password for user postgres:
    
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    # "local" is for Unix domain socket connections only
    local   all             all                                     trust
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            trust
    
    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    # su - postgres
    $ psql -U postgres -p 5433 -h localhost
    postgres=# \password postgres
    Enter new password:
    Enter it again:
    postgres=# \q
    $ exit
    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    
    更改密码:

    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    # su - postgres
    $ psql -U postgres -p 5433 -h localhost
    Password for user postgres:
    
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    # "local" is for Unix domain socket connections only
    local   all             all                                     trust
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            trust
    
    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    # su - postgres
    $ psql -U postgres -p 5433 -h localhost
    postgres=# \password postgres
    Enter new password:
    Enter it again:
    postgres=# \q
    $ exit
    # nano /etc/postgresql/9.3/<instance_name>/pg_hba.conf
    # /etc/init.d/postgresql restart
    

    面对同样的问题,找到解决方案了吗?