访问GitLab的PostgreSQL数据库

1、登陆gitlab的安装服务查看配置文件:cat /var/opt/gitlab/gitlab-rails/etc/database.yml

2、配置

1)# vim /var/opt/gitlab/postgresql/data/pg_hba.conf  

 host    all         all  192.168.1.0/24  trust    添加这行,192.168.1.0/24这个段的ip地址不需要密码可以连接

2)# /var/opt/gitlab/postgresql/data/vim postgresql.conf 

 listen_addresses = '192.168.1.12'      修改监听地址为ip

3)# gitlab-ctl restart postgresql (重启)

4)# /opt/gitlab/embedded/bin/psql -U gitlab -d gitlabhq_production -h 192.168.1.12 (不用输入密码就可进来)

5)$ alter user gitlab with password 'gitlab'               修改gitlab密码,gitlab创建的数据库超级用户为gitlab-psql,想修改密码自己通过命令修改即可

6)# vim /var/opt/gitlab/postgresql/data/pg_hba.conf  

 host    all         all  192.168.1.0/24  trust   修改trust 为md5 ,即连接需要密码

原文地址:https://www.cnblogs.com/wu-wu/p/13489258.html