访问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 ...
随机推荐
- Kafka producer介绍
Kafka 0.9版本正式使用Java版本的producer替换了原Scala版本的producer.本文着重讨论新版本producer的设计原理以及基本的使用方法. 新版本Producer 首先明确 ...
- vue的首页渲染了两次的原因以及解决方法
现在在用vue做一些单页面应用的东西,遇到了些许问题啊,比如我再渲染首页的时候,会渲染两次,查看了一下原因,原来是在写路由的时候写的格式错了: 这样的时候,初始的时候就是加载的exam_list页面, ...
- Swift - 构造函数
Swift 2.0 构造函数基础 构造函数是一种特殊的函数,主要用来在创建对象时初始化对象,为对象成员变量设置初始值,在 OC 中的构造函数是 initWithXXX,在 Swift 中由于支持函数重 ...
- RabbitMQ Queue中Arguments属性参数过期队列,过期消息,超时队列的声明
开发十年,就只剩下这套Java开发体系了 >>> 创建队列时指定参数 队列属性:x-message-ttl 可以控制被publish到queue中的message 被丢弃前能够存 ...
- PHP中$_SERVER的详细用法
PHP中$_SERVER的详细用法 $_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root相关. $_SERVER['argv'] #传递给该脚本的参数. ...
- 【python3】Mac下selenium3+chrome驱动+python3
环境: python3.6.4 seleinum3.11 事先准备好python3 环境.安装谷歌浏览器 1 安装seleinum pip3 install selenium 2 安装chrome ...
- 【cs229-Lecture4】Newton’s method
之前我们在求Logistic回归时,用的是梯度上升算法,也就是要使得似然函数最大化,利用梯度上升算法,不断的迭代.这节课引出牛顿方法,它的作用和梯度上升算法的一样的,不同的是牛顿方法所需的迭代次数更少 ...
- jQuery mobile 初始化页面的过程
- LeetCode 11 Container With Most Water(分支判断问题)
题目链接 https://leetcode.com/problems/container-with-most-water/?tab=Description Problem: 已知n条垂直于x轴的线 ...
- Cordova 3.3 开发环境搭建(视频)
图文文章参见: http://www.cnblogs.com/mlzs/p/3332199.html 视频共享链接 百度:http://pan.baidu.com/s/1c0EHfqC