首页 > 数据库 >PostgreSQL-14 安装配置-wsl_v1_ubuntu22.04

PostgreSQL-14 安装配置-wsl_v1_ubuntu22.04

时间:2023-02-07 16:00:15浏览次数:71  
标签:psql PostgreSQL 14 service ubuntu22.04 sudo postgresql your postgres

环境准备

pgAdmin: Cisco2022

postgrep数据库:
leiwang6: Leiwang6_2023
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 | {}

标签:psql,PostgreSQL,14,service,ubuntu22.04,sudo,postgresql,your,postgres
From: https://www.cnblogs.com/wl30564/p/17098735.html

相关文章

  • 暗影精灵8安装双系统(win11+ubuntu22.04 LTS)
    笔记本电脑配置惠普暗影精灵8,显卡为移动端的RTX3050Ti,自己加装了一块西数SN5701TB的固态硬盘。步骤在windows11操作系统上的准备关闭windows快速启动按下......
  • ubuntu22.04 git升级
     git--version //查看版本 sudoadd-apt-repositoryppa:git-core/ppa  //通过PPA源方式安装软件的添加PPA源到Sourcelist中的命令,新手可以了解一下ubuntu专用......
  • POJ poj 2142 The Balance 扩展欧几里得 |x|+|y|最小
    TheBalanceTimeLimit: 5000MS MemoryLimit: 65536KTotalSubmissions: 8784 Accepted: 3817DescriptionMs.IyoKiffa-Australishasabalanceandonlytwokind......
  • CodeForces - 141C Queue
    C.Queuetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIntheMainBerlandBank n peoplestandinaque......
  • 51nod 1428活动安排问题
    有若干个活动,第i个开始时间和结束时间是[Si,fi),同一个教室安排的活动之间不能交叠,求要安排所有活动,最少需要几个教室?  收起输入第一行一个正整数n(n<=10000)代表活动......
  • [Ynoi2014] 置身天上之森
    题传其实做过由乃打扑克的话思路并不难。但写代码的时候把写由乃打扑克的bug全部复现了属实难蚌注意到线段树不同区间长度是\(O(\logn)\)的,因此我们对于每种长度建......
  • CodeForces 1423G Growing flowers
    洛谷传送门CF传送门先离散化颜色。考虑对每种颜色单独求出答案。对于颜色\(x\),可以用总方案数\(n-k+1\)减去一个\(x\)都不包含的区间数量。对于这个,假设相邻两个颜......
  • 代码随想录算法Day04| 24. 两两交换链表中的节点 19.删除链表的倒数第N个节点 面试题
    24.两两交换链表中的节点题目链接: 24.两两交换链表中的节点-力扣(LeetCode)题目给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点。你必须在不修改节点......
  • 杭电1407--暴力与优化
    测试你是否和LTC水平一样高ProblemDescription大家提到LTC都佩服的不行,不过,如果竞赛只有这一个题目,我敢保证你和他绝对在一个水平线上!你的任务是:计算方程x^2+y^2+z^2......
  • 杭电1114--完全背包
    Piggy-BankProblemDescriptionBeforeACMcandoanything,abudgetmustbepreparedandthenecessaryfinancialsupportobtained.Themainincomeforthisacti......