环境准备

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. 学习Java Day23

    今天学习了包访问,没有指定public或private的部分可以被同一个包中的所有方法访问

  2. Zstack和vmware的初步印象对比

    先不说话,直接上截图吧,vmware的: zstack的: 读者不知道看出什么名堂没有?把浏览器缩放调到50%,vmware的产品线两页截屏还装不下:zstack虽然也要两屏,但都是块块,大致数了数, ...

  3. vue2 使用x2js json转换成xml

    安装: 在项目终端运行以下命令 cnpm install x2js --save 引用: // 引入模块 import x2js from 'x2js' 全部代码: <template> ...

  4. 开发者进阶必备的9个Tips & Tricks!

    优秀的开发人员市场前景是十分广阔的,但想找到一份理想的工作,仅有代码知识是不够的.优秀的工程师应该是一个终身学习者.问题的创造性解决者,着迷于整个软件世界.要成为一名优秀的开发者,应该具备哪些品质并做 ...

  5. sql查询多个结果字段通过逗号分隔为同一行显示、sql查询结果有符号分隔的字段拆分多行显示

    一.sql查询多个结果通过逗号分隔为同一行显示 sql查询数据结果 select e.ctrl_desc from t_ctrl_entry e inner join CodeGroupKeyCode ...

  6. centos7 安装MariaDB数据库

    1.添加 MariaDB yum源 #添加MariaDB.repo配置文件 vim /etc/yum.repos.d/MariaDB.repo #添加内容 [mariadb] name = Maria ...

  7. 在Qt4中添加QSerialPort模块

    在Qt5及以上的版本中提供了QSerialPort串口模块,如果想在Qt4版本中使用该模块,可以自行安装,但仅限于5.5以下的QSerialPort版本.下面就以qtserialport-openso ...

  8. C++数据结构-结构体

    C++数据结构-结构体 学生信息 http://oj.61coding.cn/problem.php?cid=1028&pid=0 #include<bits/stdc++.h> ...

  9. latex table \ref{}编号混乱

    解决:\lable{}要紧放在\caption{}下 点击查看代码 \begin{table} ... \caption{Table A} \label{TableA} ... \end{table}

  10. 关于服务器上的XML

    服务器上的 XML XML 文件是类似 HTML 文件的纯文本文件. XML 能够通过标准的 Web 服务器轻松地存储和生成. 在服务器上存储 XML 文件 XML 文件在 Internet 服务器上 ...