当前位置:网站首页>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
边栏推荐
- 正畸注意事项(持续更新中)
- [the most detailed in history] statistical description of overdue days in credit
- 【编程题】【Scratch二级】2019.09 制作蝙蝠冲关游戏
- 第四期SFO销毁,Starfish OS如何对SFO价值赋能?
- 每日刷题记录 (十六)
- 一个测试工程师的7年感悟 ---- 致在一路独行的你(别放弃)
- Preliminary test of optical flow sensor: gl9306
- HB 5469 combustion test method for non-metallic materials in civil aircraft cabin
- At the age of 35, I made a decision to face unemployment
- Seven years' experience of a test engineer -- to you who walk alone all the way (don't give up)
猜你喜欢
某马旅游网站开发(对servlet的优化)
Automated testing: robot framework is a practical skill that 90% of people want to know
[basis of recommendation system] sampling and construction of positive and negative samples
QT creator add JSON based Wizard
一鍵免費翻譯300多頁的pdf文檔
BSS 7230 航空内饰材料阻燃性能测试
[question de programmation] [scratch niveau 2] oiseaux volants en décembre 2019
Flash download setup
Detailed explanation of interview questions: the history of blood and tears in implementing distributed locks with redis
Chisel tutorial - 04 Control flow in chisel
随机推荐
10 schemes to ensure interface data security
[the most detailed in history] statistical description of overdue days in credit
智慧监管入场,美团等互联网服务平台何去何从
Fully automated processing of monthly card shortage data and output of card shortage personnel information
Anaconda+pycharm+pyqt5 configuration problem: pyuic5 cannot be found exe
在网页中打开展示pdf文件
Redis caching tool class, worth owning~
Detailed explanation of interview questions: the history of blood and tears in implementing distributed locks with redis
串联二极管,提高耐压
webflux - webclient Connect reset by peer Error
[question de programmation] [scratch niveau 2] oiseaux volants en décembre 2019
Kubectl 好用的命令行工具:oh-my-zsh 技巧和窍门
Kubectl's handy command line tool: Oh my Zsh tips and tricks
35岁那年,我做了一个面临失业的决定
第四期SFO销毁,Starfish OS如何对SFO价值赋能?
[programming problem] [scratch Level 2] December 2019 flying birds
new和delete的底层原理以及模板
Install sqlserver2019
Pigsty: out of the box database distribution
【编程题】【Scratch二级】2019.03 垃圾分类