访问GitLab的PostgreSQL数据库
1.登陆gitlab的安装服务查看配置文件
cat /var/opt/gitlab/gitlab-rails/etc/database.yml production:
adapter: postgresql
encoding: unicode
collation:
database: gitlabhq_production //数据库名
pool:
username: 'gitlab' //用户名
password:
host: '/var/opt/gitlab/postgresql' //主机
port:
socket:
sslmode:
sslrootcert:
sslca:
查看/etc/passwd文件里边gitlab对应的系统用户
[root@localhost ~]# cat /etc/passwd
root:x:::root:/root:/bin/bash
gitlab-www:x::::/var/opt/gitlab/nginx:/bin/false
git:x::::/var/opt/gitlab:/bin/sh
gitlab-redis:x::::/var/opt/gitlab/redis:/bin/false
gitlab-psql:x::::/var/opt/gitlab/postgresql:/bin/sh //gitlab的postgresql用户
2.根据上面的配置信息登陆postgresql数据库
[root@localhost ~]# su - gitlab-psql //登陆用户
-sh-4.1$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production 连接到gitlabhq_production库
psql (9.2.)
Type "help" for help.
gitlabhq_production=# \h 查看帮助命令
Available help:
ABORT CREATE FUNCTION DROP TABLE
ALTER AGGREGATE CREATE GROUP DROP TABLESPACE
ALTER COLLATION CREATE INDEX DROP TEXT SEARCH CONFIGURATION
ALTER CONVERSION CREATE LANGUAGE DROP TEXT SEARCH DICTIONARY
ALTER DATABASE CREATE OPERATOR DROP TEXT SEARCH PARSER
ALTER DEFAULT PRIVILEGES CREATE OPERATOR CLASS DROP TEXT SEARCH TEMPLATE
ALTER DOMAIN CREATE OPERATOR FAMILY DROP TRIGGER
ALTER EXTENSION CREATE ROLE DROP TYPE
…………………………………………………………………………………………………………………… gitlabhq_production-# \l //查看数据库
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------------+-------------+----------+-------------+-------------+---------------------------------
gitlabhq_production | gitlab | UTF8 | en_US.UTF- | en_US.UTF- |
postgres | gitlab-psql | UTF8 | en_US.UTF- | en_US.UTF- |
template0 | gitlab-psql | UTF8 | en_US.UTF- | en_US.UTF- | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
template1 | gitlab-psql | UTF8 | en_US.UTF- | en_US.UTF- | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
( rows) gitlabhq_production-# \dt //查看多表
List of relations
Schema | Name | Type | Owner
--------+--------------------------------------+-------+--------
public | abuse_reports | table | gitlab
public | appearances | table | gitlab
public | application_settings | table | gitlab
public | audit_events | table | gitlab
public | award_emoji | table | gitlab
public | boards | table | gitlab
public | broadcast_messages | table | gitlab
…………………………………………………………………………………………………………………… gitlabhq_production-# \d abuse_reports //查看单表
Table "public.abuse_reports"
Column | Type | Modifiers
--------------+-----------------------------+------------------------------------------------------------
id | integer | not null default nextval('abuse_reports_id_seq'::regclass)
reporter_id | integer |
user_id | integer |
message | text |
created_at | timestamp without time zone |
updated_at | timestamp without time zone |
message_html | text |
Indexes:
"abuse_reports_pkey" PRIMARY KEY, btree (id) gitlabhq_production-# \di //查看索引
List of relations
Schema | Name | Type | Owner | Table --------+-----------------------------------------------------------------+-------+--------+--------------------------------
------
public | abuse_reports_pkey | index | gitlab | abuse_reports
public | appearances_pkey | index | gitlab | appearances
public | application_settings_pkey | index | gitlab | application_settings
public | audit_events_pkey | index | gitlab | audit_events
public | award_emoji_pkey | index | gitlab | award_emoji
public | boards_pkey | index | gitlab | boards
public | broadcast_messages_pkey | index | gitlab | broadcast_messages
public | chat_names_pkey | index | gitlab | chat_names
public | ci_application_settings_pkey | index | gitlab | ci_application_settings
public | ci_builds_pkey | index | gitlab | ci_builds
public | ci_commits_pkey | index | gitlab | ci_commits
……………………………………………………………………………………………………………………………………………… gitlabhq_production=# SELECT spcname FROM pg_tablespace; //查看所有表空间
spcname
------------
pg_default
pg_global
( rows) gitlabhq_production-# \q //退出psql
-sh-4.1$ exit //退出登录用户
logout
访问GitLab的PostgreSQL数据库的更多相关文章
- 访问GitLab的PostgreSQL数据库,查询、修改、替换等操作
1.登陆gitlab的安装服务查看配置文件 cat /var/opt/gitlab/gitlab-rails/etc/database.yml production: adapter: postgre ...
- 访问GitLab的PostgreSQL数据库-(3)
1.登陆gitlab的安装服务查看配置文件 cat /var/opt/gitlab/gitlab-rails/etc/database.yml production: adapter: postgre ...
- 怎样从外网访问内网PostgreSQL数据库?
本地安装了一个PostgreSQL数据库,只能在局域网内访问到,怎样从外网也能访问到本地的PostgreSQL数据库呢?本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动PostgreSQ ...
- 更改配置:远程访问gitlab的postgresql数据库
作为这篇文章的补充: 将gitlab中的postgresql数据库开通远程访问 https://www.cnblogs.com/andy9468/p/10609682.html 替代(二)中的2.3. ...
- gitlab访问用户安装的postgresql数据库
1.先将gitlab默认安装的postgresql的数据库中的数据,导入到用户安装的postgresql数据 用Navicat迁移数据.函数不用迁移. 2.配置gitlab对postgresql数据库 ...
- 将gitlab中的postgresql数据库开通远程访问
postgresql数据库是gitlab的一个配置数据库,记录gitlab的一些配置信息. 我们访问gitlab中的postgresql数据有本地命令行访问和远程可视化软件访问2种方式. (一)本地命 ...
- PostgreSQL数据库中跨库访问解决方案
PostgreSQL跨库访问有3种方法:Schema,dblink,postgres_fdw. 方法A:在PG上建立不同SCHEMA,将数据和存储过程分别放到不同的schema上,经过权限管理后进行访 ...
- C#访问postgresql数据库
最近开始做C#的DotNet的工作,因为对PostgreSQL数据库比较有兴趣,所以自己研究了一下如何访问PostgreSQL的 数据库的问题. 1.为了访问PostgreSQL数据库,需要从pgfo ...
- C/C++访问PostgreSQL数据库
编号:1011时间:2016年5月17日09:46:01功能:Windows环境下C/C++访问PostgreSQL数据库https://segmentfault.com/a/119000000062 ...
随机推荐
- 用javascript获得地址栏参数的两种方法
javascript获得地址栏参数. 方法1: <script language="JavaScript"> //取地址栏参数 <!-- function Req ...
- Altera FPGA管脚弱上拉电阻详细设置方法
Altera FPGA管脚弱上拉电阻的软件设置方法 在使用 Altera 的 FPGA 时候, 由于系统需求, 需要在管脚的内部加上上拉电阻. Quartus II 软件中在 Assignment E ...
- JNI-获取Java对象的成员变量-GeInttField()
例: 在Java中定义一个属性,然后用C语言将其设置成另外的值,并输出出来. Java代码: Person.java package com.yuneec.demo; public class Per ...
- 黑客编程教程(十三)多线程DOS程序
DOS基本原理相信大家都已经很熟悉了,DOS工具大家也用的很熟悉.在群里 经常有人说什么时候去DOS什么东西. 现在我们就自己编写一个DOS工具. #include <winsock2.h> ...
- 78. Longest Common Prefix【medium】
Given k strings, find the longest common prefix (LCP). Example For strings "ABCD", " ...
- C++ string的用法
之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必担心内存是否足够.字符串长度等等,而且作为一个类出现,他集成的操作函数足以完成我们大多数情况下(甚至是 ...
- 索引长度过长 ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
1.发现问题 今天在修改innodb表的某个列的长度时,报如下错误: alter table test2 modify column id varchar(500); ERROR 1071 (4200 ...
- Python中if __name__ == '__main__':作用
#hello.pydef sayHello(): str="hello" print(str); if__name__=="__main__": print ( ...
- 歌手右侧快速入口ABCD....
1.通过v-for将右侧内容渲染出来,并绝对定位到右侧 2.给每个li绑定touchStart事件,并绑定自定义属性data-index=index: 3.点击每个li,通过e来获取所绑定的自定义属性 ...
- centos修改ip mac等
CentOS修改mac http://www.haowlan.com/jishuluntan/488.html CentOS 修改IP地址, DNS, 网关 http://www.21andy.com ...