🌤️ 加载中...
#
小折腾/小配置 2018-02-27

postgresql使用相关说明

By Jove 1 Views 4 MIN READ 0 Comments

管理PostgreSQL用户和数据库

1. 以管理员身份登录数据库 postgres 用户
    root@attacker:~#sudo -u postgres psql
//li连接外部数据库root@attacker:
~# psql -U postgres -h 127.0.0.1 2. 创建数据库用户及其密码 postgres=# create user msf with password 'admin'; CREATE ROLE 3. 修改数据库用户密码 postgres=# alter user postgres with password 'admin'; ALTER ROLE 4. 创建数据库及其属主 postgres=# create database msf with owner=msf; CREATE DATABASE 5. 退出数据库 postgres=# \q (退出数据库)

 

 

修改 PostgresSQL 数据库配置实现远程访问

1. 修改数据库监听地址
    root@attacker:~# vim /etc/postgresql/9.6/main/postgresql.conf
        listen_addresses = '0.0.0.0'    #59行 
        password_encryption = on    #88行 
2. pg_hba.conf是客户端认证配置文件,定义如何认证客户端
    root@attacker:~# vim /etc/postgresql/9.6/main/pg_hba.conf 
        host    all     all     0.0.0.0         md5     #93行
3. 重启 postgres 数据库服务
root@attacker:~# systemctl restart postgresql.service 

修改 Linux 系统的 postgres 用户的密码(密码与数据库用户 postgres 的密码相同)

1. 修改 postgres 数据库用户的密码
    root@attacker:~# passwd postgres 

本文由 Jove 原创

采用 CC BY-NC-SA 4.0 协议进行许可

转载请注明出处:https://www.jozxing.cc/index.php/archives/1227/

TAGS: 无标签

相关推荐

  • 暂无相关推荐,看看别的吧。

0 评论