0
点赞
收藏
分享

微信扫一扫

#yyds干货盘点# gitlab数据库的登陆处理

**.***.**.** gitlab 库的登陆处理

cat /var/opt/gitlab/gitlab-rails/etc/database.yml  查看数据库配置信息
production:
adapter: postgresql
encoding: unicode
collation:
database: gitlabhq_production
pool: 10
username: 'gitlab'
password:
host: '/var/opt/gitlab/postgresql'
port: 5432
socket:
sslmode:
sslrootcert:
sslca:
cat /etc/passwd 查看postgres用户
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
gitlab-www:x:499:499::/var/opt/gitlab/nginx:/bin/false
git:x:498:498::/var/opt/gitlab:/bin/sh
gitlab-redis:x:497:497::/var/opt/gitlab/redis:/bin/false
gitlab-psql:x:496:496::/var/opt/gitlab/postgresql:/bin/sh
su - gitlab-psql //登陆用户
-sh-4.1$ psql --help 查看帮助
-sh-4.1$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production 连接到gitlabhq_production库
gitlabhq_production=# \l 看数据库
gitlabhq_production=# \dt 查看多表
gitlabhq_production=# \d test 查看单表
gitlabhq_production=# \di 查看索引
gitlabhq_production=# select spcname from pg_tablespace; 查看所有表空间
gitlabhq_production=# SELECT * FROM web_hooks; 查看表数据
gitlabhq_production=# SELECT count(*) FROM web_hooks; 查看数据条数
gitlabhq_production=# UPDATE web_hooks SET url = '​​http://sdpjenkins.shengpayqa.com/jenkins/gitlab/build_now​​'; //修改webhook 的url
mydb=> SELECT version(); 查看版本

举报

相关推荐

0 条评论