当前位置:   article > 正文

PostgreSQL查找配置文件位置、数据所在目录_查看pg的配置文件存放的路径的命令是什么

查看pg的配置文件存放的路径的命令是什么

方案一、用数据库的超级用户登录数据库,使用查询语句查询

# su - postgres # 这里是切换到操作系统的postgres用户
$ psql # 缺省用户名的情况下,会把当前系统用户名当作数据库登录用户名,数据库的postgres是超级用户
psql (13.2 (Ubuntu 13.2-1.pgdg18.04+1))
Type "help" for help.

postgres=# show config_file; -- 查询配置文件所在位置
               config_file               
-----------------------------------------
 /etc/postgresql/13/main/postgresql.conf
(1 row)

postgres=# show data_directory; -- 查询数据储存目录
      data_directory      
--------------------------
 /data/postgresql/13/main
(1 row)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

方案二、使用操作系统root用户查找postgresql进程

# ps -ef|grep postgresql
postgres 23746     1  0 Aug31 ?        00:04:40 /usr/lib/postgresql/13/bin/postgres -D /data/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.conf
  • 1
  • 2

可以看到-D后面的参数即为数据目录,-c后面的参数即为配置文件所在位置。


转自:https://blog.csdn.net/DongGeGe214/article/details/121489384

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/434117
推荐阅读
相关标签
  

闽ICP备14008679号