Postgresql-13 installer
以梅佐酒 5/31/2021 DB
# 下载安装 Postgresql
官网下载地址 (opens new window), 阅读官网教程进行下载安装.
# 常用命令
# 启动
sudo systemctl start postgresql-13
# postgresql服务状态
sudo systemctl status postgresql-13
# 关闭
sudo systemctl stop postgresql-13
# 重启
sudo systemctl restart postgresql-13
# Postgresql 命令行
默认情况下 PostgreSQL 安装完成后,自带了一个命令行工具 SQL Shell(psql)。
Linux 系统可以直接切换到 postgres 用户来开启命令行工具:
# 切换 postgres 用户
sudo -i -u postgres
# 打开 SQL Shell(psql)
psql
# 修改配置远程连接
- 修改
postgres密码alter user postgres with password '123456' - 修改
/var/lib/pgsql/13/data/pg_hda.conf, 新增配置host all all 0.0.0.0/0 trust #允许任意ip访问 - 修改
/var/lib/pgsql/13/data/postgresql.conflisten_addresses = '*' #监听全部 - 关闭防火墙, 或者开放Postgresql端口
- 重启Postgresql
# 相关文档
https://www.postgresql.org/
http://www.postgres.cn/index.php/v2/home
https://www.runoob.com/postgresql/postgresql-tutorial.html