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

相关推荐
麦聪聊数据20 分钟前
为何通用堡垒机无法在数据库运维中实现精准风控?
数据库·sql·安全·低代码·架构
2301_7903009625 分钟前
Python数据库操作:SQLAlchemy ORM指南
jvm·数据库·python
m0_7369191041 分钟前
用Pandas处理时间序列数据(Time Series)
jvm·数据库·python
亓才孓41 分钟前
[JDBC]PreparedStatement替代Statement
java·数据库
m0_466525291 小时前
绿盟科技风云卫AI安全能力平台成果重磅发布
大数据·数据库·人工智能·安全
爱学习的阿磊2 小时前
使用Fabric自动化你的部署流程
jvm·数据库·python
枷锁—sha2 小时前
【SRC】SQL注入快速判定与应对策略(一)
网络·数据库·sql·安全·网络安全·系统安全
惜分飞2 小时前
ORA-600 kcratr_nab_less_than_odr和ORA-600 4193故障处理--惜分飞
数据库·oracle
chian-ocean2 小时前
CANN 生态进阶:利用 `profiling-tools` 优化模型性能
数据库·mysql
m0_550024632 小时前
持续集成/持续部署(CI/CD) for Python
jvm·数据库·python