大漠知秋的加油站

  • 首页
大漠知秋的加油站
你就当我的烂笔头吧
  1. 首页
  2. GitLab
  3. 正文

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

2021年2月1日 212点热度 0人点赞 0条评论
  • 查看 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 语法进行操作即可。

标签: GitLab
最后更新:2021年2月5日

大漠知秋

唯黄昏而思烛明,唯覆雪始念日暖,唯放手方知情真,今困苦而怀峥嵘,今飘零而涌乡愁,今孑然而徒唏嘘,唏嘘成愁。

点赞
< 上一篇

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2022 大漠知秋的加油站. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang