当前位置:网站首页>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
边栏推荐
- Introduction knowledge system of Web front-end engineers
- 用语雀写文章了,功能真心强大!
- [basis of recommendation system] sampling and construction of positive and negative samples
- 一键免费翻译300多页的pdf文档
- Codeworks 5 questions per day (average 1500) - day 8
- AITM3.0005 烟雾毒性测试
- Fully automated processing of monthly card shortage data and output of card shortage personnel information
- Go learning notes (2) basic types and statements (1)
- P1067 [noip2009 popularity group] polynomial output (difficult, pit)
- UIC564-2 附录4 –阻燃防火测试:火焰的扩散
猜你喜欢

How did a fake offer steal $540million from "axie infinity"?

STM32F1與STM32CubeIDE編程實例-旋轉編碼器驅動

When creating body middleware, express Is there any difference between setting extended to true and false in urlencoded?

FFA and ICGA angiography

Traduction gratuite en un clic de plus de 300 pages de documents PDF

【史上最详细】信贷中逾期天数统计说明

Laser slam learning (2d/3d, partial practice)

35岁真就成了职业危机?不,我的技术在积累,我还越吃越香了

ROS从入门到精通(九) 可视化仿真初体验之TurtleBot3

C language 005: common examples
随机推荐
一键免费翻译300多页的pdf文档
CoinDesk评波场去中心化进程:让人们看到互联网的未来
Kubectl's handy command line tool: Oh my Zsh tips and tricks
[the most detailed in history] statistical description of overdue days in credit
Robomaster visual tutorial (10) target prediction
Preliminary test of optical flow sensor: gl9306
The function is really powerful!
Connect diodes in series to improve voltage withstand
Pycharm basic settings latest version 2022
An example analysis of MP4 file format parsing
Les mots ont été écrits, la fonction est vraiment puissante!
Resolve the URL of token
Orthodontic precautions (continuously updated)
FFA与ICGA造影
2022.7.7-----leetcode.648
Database interview questions + analysis
快速回复二极管整流特性
UIC564-2 附录4 –阻燃防火测试:火焰的扩散
new和delete的底层原理以及模板
Wechat applet development beginner 1