访问GitLab的PostgreSQL数据库-(3)
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.18)
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-8 | en_US.UTF-8 |
postgres | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
template1 | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
(4 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
(2 rows)
gitlabhq_production-# \q //退出psql
-sh-4.1$ exit //退出登录用户
logout
访问GitLab的PostgreSQL数据库-(3)的更多相关文章
- 访问GitLab的PostgreSQL数据库,查询、修改、替换等操作
1.登陆gitlab的安装服务查看配置文件 cat /var/opt/gitlab/gitlab-rails/etc/database.yml production: adapter: postgre ...
- 访问GitLab的PostgreSQL数据库
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 ...
随机推荐
- ScrollView 定位
1.固定到顶部scroll_view.requestFocusFromTouch();scroll_view.setScrollX(0); 2.固定到指定位置 int[] location = new ...
- CentoOS6.6安装netcat
http://blog.csdn.net/u013673976/article/details/47084841 CentOS下安装netcat 使用zookeeper过程中,需要监控集群状态.在使用 ...
- sqlserver连接问题收集
问题1. 使用navicat连接本地sqlserver,报错“命名管道提供程序无法打开与 sql server 的连接 [2]” 解决: 参考本篇文章 <持续收集中>
- codeforces水题100道 第十二题 Codeforces Beta Round #91 (Div. 2 Only) A. Lucky Division (brute force)
题目链接:http://www.codeforces.com/problemset/problem/122/A题意:判断一个数是否能被一个lucky number整除,一个lucky number是一 ...
- 服务器搭建--Linux安装erlang
1.安装依赖环境: 1)安装GCC GCC-C++ Openssl等模块,安装过就不需要安装了 yum -y install make gcc gcc-c++ kernel-devel m4 ncur ...
- Material Design系列第一篇——Creating Apps with Material Design
Creating Apps with Material Design //创建Material Design的App Material design is a comprehensive guide ...
- 【2014年12月6日】HR交流会
今天的交流会感觉还是不错,体会到了一些东西,把它记下来. 想到什么写什么,可能没什么条理. 1.先选行业,再选职业,再选公司 根据自己的兴趣以及个人特长,能力等方面,需要定一个大概的方向,然后根据方向 ...
- goldengate 过滤对某张表的复制操作
在复制进程中配置下面的参数可以实现对一个用户下的某些表进行过滤,在复制的时候 不做任何操作. MAPEXCLUDE: Valid for Replicat Use the MAPEXCLUDE par ...
- 开发常见错误之 : Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar
SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackO ...
- C# 未能加载文件或程序集“xxx”或它的某一个依赖项。参数错误。(异常来自 HRESULT:0x80070057 (E_INVALIDARG))
错误信息: 因为电脑突然蓝屏,然后重启,再运行项目,报了这个错. 解决方案: 环境是:VS2012+Win7 通过网上查找, 4.0 删除 C:\Windows\Microsoft.NET\Frame ...