This commit is contained in:
2021-11-14 15:52:46 +08:00
parent 915c231124
commit 1e344dc204
112 changed files with 1039 additions and 1039 deletions

View File

@@ -7,11 +7,11 @@ tags: ["postgresql"]
categories: ["database"]
---
# 环境
## 环境
- CentOS 7
- PostgreSQL 10.10
# 安装
## 安装
- 安装 yum 源
```bash
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
@@ -36,13 +36,13 @@ categories: ["database"]
systemctl start postgresql-10
```
# 配置 postgresql.conf
## 配置 postgresql.conf
- 监听本机全部地址
```
clisten_addresses = '*'
```
# 配置 pg_hba.conf
## 配置 pg_hba.conf
- 配置同网段客户端可通过 pguser1 使用密码登陆 pgdb1
```bash
echo 'host pgdb1 pguser1 samenet md5' >> pg_hba.conf
@@ -52,7 +52,7 @@ categories: ["database"]
echo 'host all all all md5' >> pg_hba.conf
```
# 简单使用
## 简单使用
- 登陆数据库
```bash
su - postgres
@@ -78,7 +78,7 @@ categories: ["database"]
\q
```
# 迁移数据库目录
## 迁移数据库目录
- 停止数据库 postgresql
```bash
systemctl stop postgresql-10