当前位置:网站首页>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
边栏推荐
- Kubectl's handy command line tool: Oh my Zsh tips and tricks
- 2022.7.7-----leetcode. six hundred and forty-eight
- Data analysis series 3 σ Rule / eliminate outliers according to laida criterion
- 10 schemes to ensure interface data security
- @Detailed introduction of configuration annotation
- Install sqlserver2019
- BSS 7230 flame retardant performance test of aviation interior materials
- Open display PDF file in web page
- 【编程题】【Scratch二级】2019.03 垃圾分类
- The difference between get and post
猜你喜欢
Archery installation test
HB 5469 combustion test method for non-metallic materials in civil aircraft cabin
用语雀写文章了,功能真心强大!
Relevant methods of sorting arrays in JS (if you want to understand arrays, it's enough to read this article)
Preliminary test of optical flow sensor: gl9306
10 schemes to ensure interface data security
Chisel tutorial - 05 Sequential logic in chisel (including explicit multi clock, explicit synchronous reset and explicit asynchronous reset)
An example analysis of MP4 file format parsing
Daily question brushing record (16)
【编程题】【Scratch二级】2019.12 飞翔的小鸟
随机推荐
P1067 [noip2009 popularity group] polynomial output (difficult, pit)
Laser slam learning (2d/3d, partial practice)
快速回复二极管整流特性
如果在构造函数中抛出异常,最好的做法是防止内存泄漏?
QT creator add custom new file / Project Template Wizard
Common selectors are
When creating body middleware, express Is there any difference between setting extended to true and false in urlencoded?
80%的人答错,苹果logo上的叶子到底朝左还是朝右?
机器人(自动化)等专业课程创新的结果
全自动化处理每月缺卡数据,输出缺卡人员信息
每日刷题记录 (十六)
P1308 [noip2011 popularity group] count the number of words
Relevant methods of sorting arrays in JS (if you want to understand arrays, it's enough to read this article)
Traduction gratuite en un clic de plus de 300 pages de documents PDF
Orthodontic precautions (continuously updated)
【史上最详细】信贷中逾期天数统计说明
在网页中打开展示pdf文件
Solutions to problems in sqlserver deleting data in tables
HB 5469 combustion test method for non-metallic materials in civil aircraft cabin
Pypharm uses, and the third-party library has errors due to version problems