当前位置:网站首页>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
边栏推荐
- 光流传感器初步测试:GL9306
- STM32F1與STM32CubeIDE編程實例-旋轉編碼器驅動
- [leetcode] 20. Valid brackets
- QT and OpenGL: loading 3D models using the open asset import library (assimp) - Part 2
- 手写一个模拟的ReentrantLock
- Fully automated processing of monthly card shortage data and output of card shortage personnel information
- mysql8.0 ubuntu20.4
- Solutions to problems in sqlserver deleting data in tables
- 【編程題】【Scratch二級】2019.12 飛翔的小鳥
- At the age of 35, I made a decision to face unemployment
猜你喜欢

某马旅游网站开发(对servlet的优化)

BSS 7230 flame retardant performance test of aviation interior materials

FFA and ICGA angiography

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

ROS from entry to mastery (IX) initial experience of visual simulation: turtlebot3

Chisel tutorial - 05 Sequential logic in chisel (including explicit multi clock, explicit synchronous reset and explicit asynchronous reset)

Flash download setup
PostGIS learning

How to measure whether the product is "just needed, high frequency, pain points"

When creating body middleware, express Is there any difference between setting extended to true and false in urlencoded?
随机推荐
单机高并发模型设计
Trust orbtk development issues 2022
Database query - what is the highest data?
About the difference between ch32 library function and STM32 library function
P1308 [noip2011 popularity group] count the number of words
[basis of recommendation system] sampling and construction of positive and negative samples
Go learning notes (2) basic types and statements (1)
FFA and ICGA angiography
正畸注意事项(持续更新中)
Open display PDF file in web page
mysql8.0 ubuntu20.4
At the age of 35, I made a decision to face unemployment
Teach you to make a custom form label by hand
Chisel tutorial - 04 Control flow in chisel
Wechat applet development beginner 1
Database interview questions + analysis
Enterprise application demand-oriented development of human resources department, employee attendance records and paid wages business process cases
Chisel tutorial - 01 Introduction to Scala
用語雀寫文章了,功能真心强大!
C language learning