Centos7安装postgresql14步骤

1、进入网址

https://www.postgresql.org/download/

2、按步骤执行

复制代码
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# Install PostgreSQL:
sudo yum install -y postgresql14-server

# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
# 开机启动
sudo systemctl enable postgresql-14
#启动数据库
sudo systemctl start postgresql-14

3、查看postgres 进程

ps -ef|grep postgres

4、查看用户,安装postgresql自动创建用户postgres

grep -A 1000 "1000:1000" /etc/passwd

5、修改postgres密码(系统登录密码)

passwd postgres

6、登录postgresql,修改数据库登录密码

Linux命令:切换用户(一定要加 - ,否则不会用到该用户下环境变量)

su - postgres

Linux命令:登录postgresql

psql

SQL语句:修改用户密码

alter user postgres password '[自定义密码]';(这里是数据库的登录密码)

7、数据库常用启停命令

启动数据库

systemctl start postgresql-14

关闭数据库

systemctl stop postgresql-14

重启数据库

systemctl restart postgresql-14

连接数据库

psql

退出数据库

\q

相关推荐
正在走向自律25 分钟前
Oracle迁移至金仓数据库:PL/SQL匿名块执行失败的深度排查指南
数据库·sql·oracle·国产数据库·电科金仓
Evan芙6 小时前
RDBMS的库、表、视图、索引、设计范式总结
数据库
一叶飘零_sweeeet6 小时前
从单机到集群:Redis部署全攻略
数据库·redis·缓存
soft20015256 小时前
MySQL Buffer Pool深度解析:LRU算法的完美与缺陷
数据库·mysql·算法
C++业余爱好者6 小时前
SQL Server 中数据库管理系统、数据库实例与数据库的关系与区别
数据库·oracle
保护我方头发丶6 小时前
ESP-wifi-蓝牙
前端·javascript·数据库
tgethe6 小时前
mysql-视图详解
数据库·mysql
漂亮的小碎步丶9 小时前
【6】数据库事务与锁机制详解(附并发结算案例)
数据库·事务·锁机制
北极糊的狐9 小时前
MySQL报错Communications link failure(通信链路失败)
数据库·mysql
合方圆~小文9 小时前
4G定焦球机摄像头综合介绍产品指南
数据结构·数据库·人工智能