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

相关推荐
workflower1 小时前
软件工程-练习
数据库·需求分析·个人开发·极限编程·结对编程
扶尔魔ocy1 小时前
【QT自定义2D控件】QGraphics绘制仪表盘
数据库·qt·microsoft
yookay zhang2 小时前
达梦数据库监听进程
网络·数据库·oracle
Archy_Wang_12 小时前
centos7的mysql做定时任务备份所有数据库
数据库·mysql
Java 码农2 小时前
MySQL基础操作案例设计
数据库·mysql
友友马2 小时前
『 QT 』按钮类控件属性解析
开发语言·数据库·qt
vvw&3 小时前
如何在 Ubuntu 上安装 PostgreSQL
linux·运维·服务器·数据库·ubuntu·postgresql
qq_5470261793 小时前
Canal实时同步MySQL数据到Elasticsearch
数据库·mysql·elasticsearch
java1234_小锋4 小时前
REDIS集群会有写操作丢失吗?为什么
数据库·redis·缓存
兰若姐姐4 小时前
如何进行MSSQL提权?sp_oacreate、sp_oamethod和沙盒提权以及xp_regwrighte提权
数据库·sqlserver