Linux安装PostgreSQL

1、我是以官网的yum进行安装的

https://www.postgresql.org/download/linux/redhat/

 

2、验证是否安装成功

方式一:

[root@hecs-100756 ~]# ps -ef | grep pgsql
postgres  976522       1  0 17:03 ?        00:00:00 /usr/bin/postmaster -D /var/lib/pgsql/data
root      977044  977015  0 17:17 pts/1    00:00:00 grep --color=auto pgsql

方式二:

[root@hecs-100756 ~]# netstat -an | grep 5432
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN     
tcp6       0      0 ::1:5432                :::*                    LISTEN     
unix  2      [ ACC ]     STREAM     LISTENING     2139367  /tmp/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     2139366  /var/run/postgresql/.s.PGSQL.5432
unix  3      [ ]         STREAM     CONNECTED     2139003  /var/run/postgresql/.s.PGSQL.5432

 

3、修改密码

PostgreSQL数据库默认用户postgres的密码

步骤一:登录PostgreSQL

sudo -u postgres psql

步骤二:修改登录PostgreSQL密码

ALTER USER postgres WITH PASSWORD 'postgres';

注意:密码postgres要用引号引起来
命令最后有分号

 步骤三:退出PostgreSQL客户端

\q

 

posted @ 2023-08-09 17:30  编程小白1024  阅读(80)  评论(0编辑  收藏  举报