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

相关推荐
不剪发的Tony老师几秒前
Apache Doris:一款高性能的实时数据仓库
数据库·数据仓库
甜可儿12 分钟前
redis序列化设置
数据库·redis
GGBondlctrl17 分钟前
【SpringBoot】论坛项目中如何进行实现发布文章,以及更新对应数据库的数据更新
数据库·springboot项目·三层设计思想·文章发布项目
若云止水30 分钟前
Ubuntu 下 nginx-1.24.0 源码分析 - ngx_init_cycle 函数 - 详解(4)
数据库·nginx·ubuntu
jay丿1 小时前
Django模板系统深入
数据库·django·sqlite
千层冷面1 小时前
Redis除了做缓存还能做什么?
数据库·redis·缓存
码有余悸3 小时前
Redis:高性能的键值存储系统
数据库·redis·缓存
剑客狼心7 小时前
Oracle:什么是存储过程
数据库·oracle
小王努力学编程7 小时前
【MySQL篇】表的操作
数据库·mysql
汤汤upup7 小时前
面试八股文--数据库基础知识总结(2) MySQL
数据库·mysql·面试