Docker 运行 postgresql
docker 命令如下:
或者使用 pgvector:
pgvector 和 postgres 完全兼容,但新增了:向量支持,如需启用,登录后,选择数据库,然后使用如下命令:
CREATE EXTENSION IF NOT EXISTS vector;
postgres 常用命令
登录 postgres 控台
如需指定数据库用户,则使用:psql -U xxx
postgres 创建用户
create user appflowy with password 'appflowy';
postgres 新建数据库
create database appflowy owner appflowy;
如需启用向量支持,则继续执行:
CREATE EXTENSION IF NOT EXISTS vector;
postgres 数据库授权
grant all privileges on database appflowy to appflowy;
postgres 列出用户
\l;
postgres 列出数据库
\du;
postgres 切换数据库
\c appflowy;
postgres 列出表
\d;
postgres 备份与还原
postgres 数据备份
pg_dump -U appflowy -d appflowy -Fc -f /tmp/dump.bak;
postgres 定时备份
postgres 数据还原
pg_restore -U outline -d outline /tmp/dump.bak
最后更新于