Onela@胡邹不胡诌
_

Postgres容器化安装与常用使用笔记

Jan 11, 2022 · 1 min · PostgresSQL

Docker容器化安装PostgresSQL

shell

# docker 容器化安装PostgresSQL
docker run --name pgsql --restart always -e POSTGRES_PASSWORD=your_password -p 15432:5432 -v /data/middleware/postgresql/:/var/lib/postgresql -d postgres
 

docker: error pulling image configuration:

docker pull image镜像报错:

shell

error pulling image configuration: download failed after attempts=6: dial tcp [2a03:2880:f111:83:face:b00c:0:25de]:443: i/o timeout

解决:

shell

vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://registry.docker-cn.com","https://nrbewqda.mirror.aliyuncs.com","https://dmmxhzvq.mirror.aliyuncs.com"]
}

重启dockersystemctl restart docker

PostgresSQL常用SQL笔记

sql

-- 查询pg版本
SELECT * FROM version();
 
-- 查询pg是否安装aes加解密模块
SELECT * FROM pg_available_extensions;
-- 找到:pgcrypto	| 1.3	 |	cryptographic functions
-- 启动pgcrypto的支持
-- CREATE EXTENSION pgcrypto;
 
 
-- 刷新权限
grant select on all tables in  schema public to your_user #
 
 
Edit this page on GitHub Last updated: 2024/6/17 19:47:43