# 【从零开始配置VPS】07：PostgreSQL

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14

    version: '3.3'
    services:
        db:
            container_name: postgres-db
            environment:
                - TZ=Asia/Shanghai
                - POSTGRES_USER=root
                - POSTGRES_PASSWORD=ROOT_ACCESS_PASSWORD
            ports:
                - '5432:5432'
            volumes:
                - './pgdata:/var/lib/postgresql/data'
            image: postgres
            restart: unless-stopped

- mkdir -p ~/db/PostgreSQL && cd ~/db/PostgreSQL && nano docker-compose.yml

- sudo docker-compose up -d

- sudo docker exec -it postgres-db psql

- 使用命令 `\q` 退出psql

### 创建新数据库

- create user ttrss with password ‘ttrss_passwd’; #创建用户ttrss

- CREATE DATABASE ttrss OWNER ttrss; #创建用户数据库

- GRANT ALL PRIVILEGES ON DATABASE ttrss TO ttrss; #权限都赋予ttrss

从零开始配置VPS
【从零开始配置VPS】07：PostgreSQL
https://occdn.limour.top/2511.html
Author
Limour
Posted on
January 12, 2023
Licensed under
【转载】Docker搭建MicroBin Previous
【树莓派】将U盘格式化为F2FS格式并挂载 Next

#### Search

Keyword