环境准备

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. 基于IGServer的Web地图要素空间分析

    1. 引言 MapGIS IGServer 是中地数码的一款跨平台GIS 服务器产品,提供了空间数据管理.分析.可视化及共享服务 MapGIS IGServer的下载(试用)地址:MapGIS IGS ...

  2. 全局视角看技术-Java多线程演进史

    作者:京东科技 文涛 全文较长共6468字,语言通俗易懂,是一篇具有大纲性质的关于多线程的梳理,作者从历史演进的角度讲了多线程相关知识体系,让你知其然知其所以然. 前言 2022年09月22日,JDK ...

  3. nginx中多ip多域名多端口配置

    1.Nginx中多IP配置: server { listen 80; server_name 192.168.15.7; location / { root /opt/Super_Marie; ind ...

  4. TCP怎样保证可靠传输

    TCP的可靠性保证 TCP主要提供了检验和,序列号/确认应答,超时重传,最大消息长度,滑动窗口控制等方法实现了可靠性传输. 检验和 通过检验和的方式,接收端可以检测出来数据是否有差错和异常,假如有差错 ...

  5. RISC-V核及工具链整理

    RISC-V开源核分为开源核(无外设).SOC.FPGA.多核等多种框架. 开源核 SOC框架 平头哥无剑100 包括EDA仿真框架及FPGA框架 https://github.com/T-head- ...

  6. plesk 关闭维护模式

    最近遇到访问plesk时出现maintanase mode模式,于是网上搜了答案都是老外的,且没有明确怎么解决,但可能造成这一问题的原因也很多,我这个是这么解决的,和大家分享下,希望可以起到一个思路引 ...

  7. flexible.js源码分析

    (function flexible(window,document){ // 获取html的根元素 var docEl = document.documentElement; // dpr 物理像素 ...

  8. pictrue类的练习

    这里遇到一个问题,因为导入的文件格式很大,所以内存占用特别高,就会在运行一段时间过后报错:内存不够 然后用了一个GC.collect():的方法,加在了timer控件里,让程序每隔1000ms换图时也 ...

  9. Pyodide 中实现网络请求的 3 种方法

    原文:https://lwebapp.com/zh/post/pyodide-fetch 需求 小编之前提过一个在线 Python 工具,核心技术是用到了一个叫 Pyodide 的库,能够让 Pyth ...

  10. 基于VS码代码时出现访问错误的个人理解

    日常在VS写代码中,有时候我们将写好的代码调试出来会出现有未经处理的异常,在0x00000000XXXX处有未经处理的异常,写入位置0xFFFFFFFFFFFFXX时发生访问冲突. 类似于图中情况,遇 ...