环境准备

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. Element ui&图标、按钮、超链接、单选框

    ElementUI&Vant ui 基于Vue的一套桌面端的组件库,提前封装好的UI模版,方便开发者快速搭建一个网站前端界面. 官网:https://element.eleme.cn/#/zh ...

  2. centos7设置python路径

    直接在命令行运行.py 文件: [clouder@ana53 common]$ python3 driver.py Traceback (most recent call last): File &q ...

  3. [NOI Online 2022 提高组] 如何正确地排序

    \(\text{Solution}\) 当 \(m=2\) 时,\(ans=2n\sum a_{i,j}\) 当 \(m=3\) 时 当然先套路地考虑某一行的贡献,记为第 \(x\) 行 则当取 \( ...

  4. P4238 【模板】多项式乘法逆

    #include <cstdio> #include <iostream> #define re register using namespace std; typedef l ...

  5. JZOJ 4308.长寿花

    题面 思路 这种题当然要 \(dp\) 啦 设 \(g_{i,j}\) 表示前 \(i\) 个位置用指定的 \(j\) 种颜色装饰(即用颜色 \(1..j\) 来装饰) 那么 \(g_{i,j}=g_ ...

  6. PHP封装自定义函数function

    最近一直在看PHP教程,毕竟懂点PHP语言还是不错的选择,起初是准备制作一个三文件夹内关键词组合长尾关键词,然后用PHP做一个全站的动态聚合页面的一个PHP插件,不负有心人啊!已写好,稍晚整理会在资源 ...

  7. a^b(位运算&快速幂)

    题目链接 题目: 题解:很简单.经典的的一道快速幂的题 注意一下用LL型就ok. 代码: 1 #include <map> 2 #include <set> 3 #includ ...

  8. CSS 定位position

    .link span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }

  9. svn拉取出现目标机器积极拒绝,无法连接

    问题如图: 前言 这边服务器环境上的SVN仓库地址不能连接,不能提交代码和下载代码了,错误内容就是"由于目标计算机积极拒绝,无法连接.." 出错的原因 询问了相关的事项,知道了这次 ...

  10. Linux操作命令(七) 1.cut命令 2.paste命令 3.tr命令

    1.cut 命令 常用参数 参数 描述 -b 以字节为单位进行分割 -c 以字符为单位进行分割 -d 自定义分隔符,默认为制表符 -f 自定义字段 --complement 抽取整个文本行,除了那些由 ...