龙空技术网

postgresql在centos安装

随风飘1990 119

前言:

此时各位老铁们对“centos70postgresql”大体比较注重,姐妹们都需要了解一些“centos70postgresql”的相关资讯。那么小编也在网上网罗了一些有关“centos70postgresql””的相关资讯,希望我们能喜欢,兄弟们快快来学习一下吧!

一、安装

# Install the repository RPM:sudo yum install -y  Install PostgreSQL:sudo yum install -y postgresql14-server# Optionally initialize the database and enable automatic start:sudo /usr/pgsql-14/bin/postgresql-14-setup initdbsudo systemctl enable postgresql-14sudo systemctl start postgresql-14

二、配置

一)安装目录:/var/lib/pgsql/14/data/

1)vim postgresql.conf 修改开放端口

listen_addresses = '*'

2)vim pg_hba.conf 修改对外开放 在最后一行加入此描述

host all all 0.0.0.0/0 trust

二)云主机修改安全组 增加5432端口出入组放开

三、远程连接

通过datagrip远程连接即可,连接之前配置好相应的数据库用户名、密码以及创建好数据库等

postgres=# create user "abcd" with password '123456';

postgres=#create database "abcd" with owner = "abcd";

标签: #centos70postgresql