postgresql常用命令

参考:
https://blog.csdn.net/zhangzeyuaaa/article/details/77941039
https://blog.csdn.net/warrior_0319/article/details/78091949

su - postgres
postgres@ubuntu:~$ psql

查看所有数据库:

postgres=# \l

postgresql常用命令_第1张图片

\c + 数据库名

进入数据库。
参考:https://www.runoob.com/postgresql/postgresql-select-database.html

列出所有用户:

postgres=# \du

postgresql常用命令_第2张图片

\c bitbucket_6_1_1  # 选择数据库
select prop_value from app_property where prop_key = 'license';  # 查询
UPDATE app_property SET prop_value = 'xxx'  where prop_key = 'license';  # 重新设置值

参考:
https://www.yiibai.com/postgresql/postgresql-update.html

创建用户、数据库,并授权。

postgres=# create user bitbucket with password 'bitbucket';
CREATE ROLE
postgres=# create database bitbucket_6_1_1 owner bitbucket;
CREATE DATABASE
postgres=# grant all privileges on database bitbucket_6_1_1 to bitbucket;
GRANT

postgresql常用命令_第3张图片

postgresql常用命令_第4张图片

程序链接PostgreSQL 时报错"no pg_hba.conf entry"

参考:https://blog.csdn.net/liuchunming033/article/details/44810899
找到对应的pg_hba.conf文件:
在这里插入图片描述

然后添加postgresql客户端的IP范围:
在这里插入图片描述
加一行:

host    all             all             192.168.85.0/24         md5

你可能感兴趣的:(Web,安全)