访问 GitLab 自带 PostgreSQL 数据库,查询、修改、替换等

  • 查看 PostgreSQL 配置信息:
$ cat /var/opt/gitlab/gitlab-rails/etc/database.yml 

# This file is managed by gitlab-ctl. Manual changes will be
# erased! To change the contents below, edit /etc/gitlab/gitlab.rb
# and run `sudo gitlab-ctl reconfigure`.

production:
  adapter: postgresql
  encoding: unicode
  collation:
  # 数据库
  database: gitlabhq_production
  pool: 10
  # 用户名
  username: "gitlab"
  password:
  host: "/var/opt/gitlab/postgresql"
  port: 5432
  socket:
  sslmode:
  sslcompression: 0
  sslrootcert:
  sslca:
  load_balancing: {"hosts":[]}
  prepared_statements: false
  statements_limit: 1000
  fdw:
  • 查看 /etc/passwd 文件里边 gitlab 对应的系统用户
$ cat /etc/passwd
......
gitlab-psql:x:996:996::/var/opt/gitlab/postgresql:/bin/sh
......

# 切换到对应用户
$ su - gitlab-psql
  • 连接数据库
$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
psql (9.6.11)
Type "help" for help.

gitlabhq_production=#

后边使用 PostgreSQL 语法进行操作即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值