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

相关推荐
阿成学长_Cain22 分钟前
Linux dirs命令详解|Bash目录堆栈管理快速切换目录实战教程
linux·运维·前端·数据库
ywl47081208729 分钟前
Mysql 平衡二叉树、红黑树、B树、B+树区别以及应用场景(五)
数据库·b树·mysql
IvorySQL1 小时前
IvorySQL Agent 探索与实践
数据库·人工智能·postgresql·oracle·ivorysql
SelectDB2 小时前
美团数十 PB 规模 Apache Doris 实践:从统一 OLAP 到 AI-Native 数据基座
大数据·数据库·性能优化
Database_Cool_2 小时前
阿里云RDS主从延迟解决方案_只读实例半同步复制最佳实践
数据库·人工智能
KaMeidebaby3 小时前
卡梅德生物技术快报|小 RNA 适配体合成 + 多方法亲和力表征全流程标准化操作手册
前端·网络·数据库·人工智能·算法
卓怡学长3 小时前
w269基于spring boot + vue 候鸟监测数据管理系统
java·数据库·spring boot·spring·intellij-idea
ClouGence3 小时前
MySQL 到 StarRocks 数据迁移同步:同步方案与实践指南
数据库·mysql
行业研究员3 小时前
当数据生产者变成 Agent,数据库底座如何重构?
大数据·数据库·重构
人工智能培训4 小时前
破解数据发展瓶颈 激活数字经济新动能
大数据·数据库·人工智能·深度学习·神经网络·机器学习·生成对抗网络