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

相关推荐
白云偷星子15 分钟前
MySQL笔记14
数据库·笔记·mysql
绵绵细雨中的乡音1 小时前
MySQL 常用函数实操指南:从基础到实战案例
数据库·mysql
凉栀お_2 小时前
MySQL相关知识查询表中内容(第二次作业)
数据库·mysql
ss2732 小时前
手写Spring第7弹:Spring IoC容器深度解析:XML配置的完整指南
java·前端·数据库
PFinal社区_南丞3 小时前
PostgreSQL-10个鲜为人知的强大功能
数据库·后端
misty youth3 小时前
配置openguass 教程(自存)
数据库·ubuntu·华为·openguass
瑞士卷@4 小时前
MyBatis入门到精通(Mybatis学习笔记)
java·数据库·后端·mybatis
白云偷星子4 小时前
MySQL笔记13
数据库·笔记·mysql
施嘉伟4 小时前
静默安装金仓数据库,到底有多简单?
数据库
Tapdata4 小时前
实时物化视图的新路径:从传统 Join 到跨源实时查询
数据库