zoukankan      html  css  js  c++  java
  • PostgreSQL 密码忘了

    许久不登, 倒是把默认的 postgres 用户的密码给忘了...

    首先关闭 PostgreSQL.

    我这是 Windows 上安装的, 所以到服务 (services.msc) 里关闭.

    然后修改配置, 把 md5 改成 trust.

    到 PostgreSQL 的安装目录下找到 pg_hba.conf

    # pg_hba.conf
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    # IPv6 local connections:
    host    all             all             ::1/128                 md5
    # Allow replication connections from localhost, by a user with the
    # replication privilege.
    host    replication     all             127.0.0.1/32            md5
    host    replication     all             ::1/128                 md5
    

    然后重启服务, 使用如下命令修改 postgres 用户的密码

    D:PostgreSQL11in>psql -U postgres
    psql (11.5)
    输入 "help" 来获取帮助信息.
                                           
    postgres=# alter user postgres with password 'your_password';
    ALTER ROLE
    postgres=#
    

    记得重新关闭服务, 然后把 trust 改回 md5 后, 重启服务.

    搞定. 又可以欢快的在 pgAdmin 里玩耍啦...

  • 相关阅读:
    JS内容左右滑动
    JS返回上一页
    两栏 三栏的css
    舅舅去世
    .net学习开始
    以论坛管理的方式来处理公司资讯
    《尽管去做》摘
    网页视频播放器代码集
    火影忍者和海贼王
    古代风水文献
  • 原文地址:https://www.cnblogs.com/taadis/p/12435872.html
Copyright © 2011-2022 走看看