当前位置:网站首页>SQL knowledge summary 004: Postgres terminal command summary
SQL knowledge summary 004: Postgres terminal command summary
2022-07-08 00:05:00 【Cloth scholar Python】
I am using postgresql Container created postgresql database , Therefore, the following commands are based on this !
1. Enter into container :
docker exec -it Containers id /bin/bash
2. Command line login database , Enter the database created by default :
The format is :
psql -U username -h ipaddress -d dbname
My is :
psql -U postgres -d postgres
3. List all databases :
postgres=# \l
4. Switch database :
postgres=# \c tododb
among ,tododb Is my other database name
5. List the tables under the current database
Because my database only has postgres There's data in , therefore , First use \c Switch back , Reuse \d View all tables in the database :
postgres=# \d
6. Show current database
postgres=# select current_database()
7. List all the fields of the table
postgres=# \d tablename
8. Check the basic information of the table
postgres=# \d+ tablename
9. Change database password :
alter user postgres with password '654321';
Note that the password is ’ ‘ Enclosed content ! Don't lose the last ; Number , Otherwise nothing can be done .
It's also easy to change the password expiration time :
alter user postgres with valid until '2017-01-01 08:00:00';
If you want to change it to never expire :
alter user postgres with valid until 'infinity';
10. Log out
postgres=# \q
边栏推荐
- 【编程题】【Scratch二级】2019.03 绘制方形螺旋
- Chisel tutorial - 00 Ex.scala metals plug-in (vs Code), SBT and coursier exchange endogenous
- 数据湖(十五):Spark与Iceberg整合写操作
- Open display PDF file in web page
- Gorm Association summary
- 52岁的周鸿祎,还年轻吗?
- Problems faced when connecting to sqlserver after downloading (I)
- Aitm3.0005 smoke toxicity test
- Chisel tutorial - 05 Sequential logic in chisel (including explicit multi clock, explicit synchronous reset and explicit asynchronous reset)
- 【推荐系统基础】正负样本采样和构造
猜你喜欢
The result of innovation in professional courses such as robotics (Automation)
new和delete的底层原理以及模板
How does starfish OS enable the value of SFO in the fourth phase of SFO destruction?
【編程題】【Scratch二級】2019.12 飛翔的小鳥
95. (cesium chapter) cesium dynamic monomer-3d building (building)
单机高并发模型设计
【编程题】【Scratch二级】2019.03 垃圾分类
Preliminary test of optical flow sensor: gl9306
串联二极管,提高耐压
一鍵免費翻譯300多頁的pdf文檔
随机推荐
How to put recyclerview in nestedscrollview- How to put RecyclerView inside NestedScrollView?
Flash download setup
[the most detailed in history] statistical description of overdue days in credit
QT creator add custom new file / Project Template Wizard
在网页中打开展示pdf文件
Pypharm uses, and the third-party library has errors due to version problems
关于组织2021-2022全国青少年电子信息智能创新大赛西南赛区(四川)复赛的通知
Seven years' experience of a test engineer -- to you who walk alone all the way (don't give up)
An example analysis of MP4 file format parsing
[programming problem] [scratch Level 2] December 2019 flying birds
一键免费翻译300多页的pdf文档
webflux - webclient Connect reset by peer Error
Data analysis series 3 σ Rule / eliminate outliers according to laida criterion
P1067 [noip2009 popularity group] polynomial output (difficult, pit)
Rectification characteristics of fast recovery diode
[path planning] use the vertical distance limit method and Bessel to optimize the path of a star
单机高并发模型设计
Use filters to count URL request time
一份假Offer如何盗走了「Axie infinity」5.4亿美元?
C language 005: common examples