centos7 安装 postgresql,navicat连接

preface

最近在用 ionic5-react 搭建移动端项目, 好忙啊, 今天晚上有空,搭建一个项目,需要用到 postgresql

postgresql 安装配置

1. 官网

官文上有 yum 安装 postgresql

postgresql

centos7 安装 postgresql,navicat连接_第1张图片
按步骤操作即可

2. 设置 navicat 访问

2.1 修改用户密码

[root@www ~]# su postgres    //yum安装的默认创建一个'postgres'用户
bash-4.2$ psql -U postgres    //  进入postgres数据库
psql (9.6.9)
Type "help" for help.
 
postgres=#                    
postgres=# alter user postgres with password '密码'

2.2 允许远程访问

[root@localhost data]# find / -name postgresql.conf
/var/lib/pgsql/data/postgresql.conf

// 修改listen_addresses = 'localhost'  改为 listen_addresses = '*'   需重启服务
vim /var/lib/pgsql/data/pg_hba.conf
# 添加如下一行
host    all             all             0.0.0.0/0               md5

重启 postsql 服务 service postgresql restart

3. 测试

navicat 选择 【连接】-> 【postgresql】
centos7 安装 postgresql,navicat连接_第2张图片

参考

参考网址

你可能感兴趣的:(database)