微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CentOS7.5安装配置PostgreSQL11

CentOS系统中安装postgresql的rpm源

yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

安装客户端:

yum install postgresql11

安装服务端:

yum install postgresql11-server

 

yum install postgresql11-devel

初始化数据库

/usr/pgsql-11/bin/postgresql-11-setup initdb

启动数据库并设置开机启动:

systemctl enable postgresql-11
systemctl start postgresql-11

登录Postgresql设置密码

su root          #首先获取root权限
su - postgres    #登录数据库
psql

设置密码

ALTER USER postgres WITH PASSWORD '密码';

\q 退出

\l  列出所有库

\du 列出所有用户

\d 列出库下所有表


认情况下postgresql是不用密码不支持远程登录的。需要修改配置文件:

vi /var/lib/pgsql/11/data/pg_hba.conf

修改前:

修改后:

vi /var/lib/pgsql/11/data/postgresql.conf

修改前:

 

修改后:

重启postgresql

systemctl restart postgresql-11

参考资料:

1. https://www.linuxidc.com/Linux/2017-10/147536.htm

2. https://blog.csdn.net/rudy5348/article/details/79299162

3. https://blog.csdn.net/u012325865/article/details/81941461

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐