环境准备

pgAdmin: Cisco2022

postgrep数据库:
postgres: Postgres_2023

install

https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-database

Update your Ubuntu packages: sudo apt update
Once the packages have updated, install PostgreSQL (and the -contrib package which has some helpful utilities) with: sudo apt install postgresql postgresql-contrib
Confirm installation and get the version number: psql --version

There are 3 commands you need to know once PostgreSQL is installed:

sudo service postgresql status for checking the status of your database.
sudo service postgresql start to start running your database.
sudo service postgresql stop to stop running your database.

The default admin user, postgres, needs a password assigned in order to connect to a database. To set a password:

Enter the command: sudo passwd postgres
You will get a prompt to enter your new password.
Close and reopen your terminal.

To run PostgreSQL with psql shell:

Start your postgres service: sudo service postgresql start
Connect to the postgres service and open the psql shell: sudo -u postgres psql

Once you have successfully entered the psql shell, you will see your command line change to look like this: postgres=#

To see what user accounts have been created on your PostgreSQL installation, use from your WSL terminal: psql -c "\du" ...or just \du if you have the psql shell open

postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

配置远程访问

vim /etc/postgresql/14/main/pg_hba.conf

# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
host all all 0.0.0.0/0 md5 # 这行是新增的
修改后 重启服务生效

添加用户并授权远程访问

# 切换成postgres用户
su postgres
# 链接数据库
psql
# 创建数据库用户
create user liam with password 'Liam2022';
# 创建数据库
create database liam_db owner liam;
# 授权
grant all privileges on database liam_db to liam;
# 创建superuser
create user leiwang6 password 'Leiwang6' superuser createrole createdb REPLICATION;

PostgreSQL-14 安装配置-wsl_v1_ubuntu22.04的更多相关文章

  1. Ubuntu20.04 PostgreSQL 14 安装配置记录

    PostgreSQL 名称来源 It was originally named POSTGRES, referring to its origins as a successor to the Ing ...

  2. mysql 5.7.14 安装配置方法图文教程(转)

    http://www.jb51.net/article/90259.htm ******************************** 因笔者个人需要需要在本机安装Mysql,先将安装过程记录如 ...

  3. Caffe学习系列(1):安装配置ubuntu14.04+cuda7.5+caffe+cudnn

    一.版本 linux系统:Ubuntu 14.04 (64位) 显卡:Nvidia K20c cuda: cuda_7.5.18_linux.run cudnn: cudnn-7.0-linux-x6 ...

  4. Kubernetes及Dashboard详细安装配置(Ubuntu14.04)

    前些日子部门计划搞并行开发,需要对开发及测试环境进行隔离,所以打算用kubernetes对docker容器进行版本管理,搭建了下Kubernetes集群,过程如下: 本流程使用了阿里云加速器,配置流程 ...

  5. Mysql5.7.14安装配置

    Mysql5.7.14免安装版配置方法: 运行 在命令行中输入 mysqld install mysql5.7 安装成功后,启动mysql 在命令行中输入 net start mysql5.7 这个时 ...

  6. postgresql+slony-i安装配置主从

    slon软件下载地址:slony1-1.2.6 http://slony.info/downloads/1.2/source/ postgresql下载地址: http://www.postgresq ...

  7. CentOS下Redis 2.2.14安装配置详解(转载)

    一. 下载redis最新版本2.2.14 cd /usr/local/src wget –c http://redis.googlecode.com/files/redis-2.2.14.tar.gz ...

  8. Hadoop安装配置(ubuntu-12.04.2-server-amd64)

    环境如下: ubuntu-12.04.2-server-amd64 hadoop-1.0.4 VirtualBox 1.在VBox中安装Ubuntu Server,用户名和密码都是hadoop,安装完 ...

  9. mysql 5.7以上版本安装配置方法图文教程(mysql 5.7.12\mysql 5.7.13\mysql 5.7.14)(转)

    http://www.jb51.net/article/90302.htm ******************************* 这篇文章主要为大家分享了MySQL 5.7以上缩版本安装配置 ...

  10. Ubuntu 14.04 安装配置备忘录

    完全在 Linux 下工作,大概有3年时间了. 之前都是用 Windows, 而把 Linux 装在虚拟机里,现在反过来,把 Windows 装在了虚拟机里,只是因为偶尔还要用网银的缘故. 以我这几年 ...

随机推荐

  1. 【译】.NET 7 中的性能改进(二)

    原文 | Stephen Toub 翻译 | 郑子铭 堆栈替换 (On-Stack Replacement) 堆栈替换 (OSR) 是 .NET 7 中最酷的 JIT 功能之一.但要真正了解 OSR, ...

  2. SpringBoot集成Tomcat服务

    目录 一.Tomcat集成 1.依赖层级 2.自动化配置 二.Tomcat架构 三.Tomcat配置 1.基础配置 2.属性配置类 3.配置加载分析 四.周期管理方法 1.控制类 2.核心方法 五.参 ...

  3. HGAME2023_WP_WEEK2

    Git Leakage Githack一波带走,下载得到flag v2board 搜索得知V2Board存在越权漏洞,随便注册个账号拿到authorization 访问/api/v1/admin/us ...

  4. 与TNF拮抗剂治疗AS临床和MRI疗效相关的血清生物标记物

    与TNF拮抗剂治疗AS临床和MRI疗效相关的血清生物标记物 PresentID: THU0223 SERUM BIOMARKERS ASSOCIATED WITH CHANGES IN ASDAS A ...

  5. Map Inference in the Face of Noise and Disparity代码环境搭建

    1. 引言 地图生成算法网站Mapconstruction by pfoser里可以看到许多关于地图生成算法的介绍,Map Inference in the Face of Noise and Dis ...

  6. 排查问题-输出pojo日志,尽量用json

    背景: 下午在做一个前后端md5加密签名校验. 前端用参数A,B,C,经过MD5加密函数,得到签名D. 然后前端带着ABCD一块来到后端. 同样的,后端拿到请求后,用MD5函数对ABC进行加密,得到签 ...

  7. rust 计算两个经纬度的距离

    依赖库 math_adapter={ version = "0.3.1", features = [ "cgmath_ops" ] } 实现 use math_ ...

  8. Vulnhub:ReconForce-01.1靶机

    kali:192.168.111.111 靶机:192.168.111.200 信息收集 端口扫描 nmap -A -v -sV -T5 -p- --script=http-enum 192.168. ...

  9. [版本控制-Git]-git学习总结

    1.如何将本地的文件添加到已经建好的远程分支上: 1.1 本地文件夹内,右键-git bash - 创建新仓 git init 1.2 git remote add origin 远程仓库的githu ...

  10. ComWin’ round 11部分题解

    https://vjudge.net/contest/325913#overview A.Threehouses 题意:一直二维平面上的$n$个点中,前$e$个点落在小岛周围,并且有$p$条边已经连接 ...