postgresql数据库

postgrespl数据库(电脑编辑器有点问题稍后修改)

为什么使用postgresql

  • 在现有的数据库环境中postgresql数据库可以说是唯一一个纯免费的数据库。
  • 等等,

在linux上安装

自此我们就安装成功了

{{uploading-image-484697.png(uploading...)}}
运行并查看是否正常运行。

  • 配置一下:pgsql10配置文件位置默认在:/var/lib/pgsql/10/data/postgresql.conf

CONNECTIONS AND AUTHENTICATION

  • Connection Settings -

listen_addresses = 'localhost' # what IP address(es) to listen on; 本机ip以及本地localhost才能访问
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart) 端口号看自己情况

  • 日志参数,内存参数,自己找文档解析。

  • 认证权限配置文件: /var/lib/pgsql/9.6/data/pg_hba.conf

    命令行的各个参数解释说明:
    -U username 用户名,默认值postgres
    -d dbname 要连接的数据库名,默认值postgres。如果单指定-U,没指定-d参数,则默认访问与用户名名称相同的数据库。
    -h hostname 主机名,默认值localhost
    -p port 端口号,默认值5432

然后就是创建用户和数据库了

  • 使用postgresql用户登录
  • create user test_user with password 'abc123'; // 创建用户
    create database test_db owner test_user; // 创建数据库
    grant all privileges on database test_db to test_user; // 授权
  • 退出psql(输入 \q 再按回车键即可)

最后就是使用了:https://www.cnblogs.com/orangeform/archive/2012/06/08/2315679.html

或者打开远程使用Navicat工具使用

posted @ 2022-06-06 09:56  whml  阅读(344)  评论(0编辑  收藏  举报