码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 查找postgreSQL环境pg_hba.conf文件位置


    默认情况下,刚刚安装完成的 postgresSQL12 无法使用 数据库连接工具连接。需要为其修改配置,开放连接权限。

    主要涉及两个配置文件的修改:

    1:pg_hba.conf 

    其中,它的文件存放路径,随着不同版本,可能不一致。

    2:postgresql.conf

    Postgre10 Windows环境:

    data\PostgreSQL\10\data文件下

    host   all    all    0.0.0.0/0    md5

    Postgre12   Linux环境:

    一次输入如下前三条命令

    1. sudo su - postgres
    2. psql -U postgres
    3. postgres=# select setting from pg_settings where name like '%hba%';
    4. setting
    5. -------------------------------------
    6. /etc/postgresql/12/main/pg_hba.conf
    7. (1 row)
    8. postgres=#

    修改pg_hba.conf文件中关于ipv4的127.0.0.1/32 md5 改为0.0.0.0/0 trust

    修改postgresql.conf文件中关于listen_address中'localhost'为'*'

    修改了配置后,需要reload一下方可生效:

    postgres=# select pg_reload_conf();

    然后重启postgre 

    sudo service postgresql start

    有些在 

    /var/lib/pgsql/data/pg_hba.conf

    参见:

    Linux安装并启动PostgreSQL_szuwangjl的博客-CSDN博客_linux postgresql 启动

    https://www.jianshu.com/p/47fbd8caba82

    Once PostgreSQL is installed you may want to create a new user or set the password for the the main user. The instructions below will help to set the password for main postgresql user

    1. sudo su - postgres
    2. psql
    3. \password
    4. \q

    Then, press “Ctrl+D” to return to main user console and connect to the database to create thingsboard DB:

    1. psql -U postgres -d postgres -h 127.0.0.1 -W
    2. CREATE DATABASE thingsboard;
    3. \q

  • 相关阅读:
    SpringBoot使用Nacos作为配置中心服务
    软件测试 | 软件测试面试题大全(带回答),offer拿来吧你......
    halcon学习和实践(第一个范例threshold.hdev)
    无法将类型为“Newtonsoft.Json.Linq.JObject”的对象转换为类型“Newtonsoft.Json.Linq.JArray”解决方法
    Python进阶(五)-图形界面编程Tkinter(5)
    Amazon云计算AWS(四)
    【Linux】 uptime命令使用
    spring boot 自定义druid数据源,如何注入配置
    Redhat(9)-磁盘分区-parted-swap-lvm-stratis-vdo-tuned
    java面试题(十五道)
  • 原文地址:https://blog.csdn.net/figosoar/article/details/126749288
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号