File tree Expand file tree Collapse file tree 1 file changed +38
-9
lines changed
Expand file tree Collapse file tree 1 file changed +38
-9
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,49 @@ logo: postgresql
88
99- [ postgresql.org/docs/] ( https://www.postgresql.org/docs/ )
1010- [ postgresqltutorial.com] ( https://www.postgresqltutorial.com/ )
11+ - [ Postgres Cheatsheet] ( https://www.postgresqltutorial.com/postgresql-cheat-sheet/ )
1112
13+ ## Show
1214
13- ## Show database
15+ ### Show database
1416
1517```
1618\l
1719```
1820
1921[ source] ( https://www.postgresqltutorial.com/postgresql-show-databases/ )
2022
21- ## Login
23+ ### Tables
24+
25+ Show all tables.
26+
27+ ```
28+ \dt
29+ ```
30+ For more info.
31+ ```
32+ \dt+
33+ ```
34+
35+ Get info on a table.
36+
37+ ```
38+ \d+ table_name
39+ ```
40+
41+
42+ ## Quit
43+
44+ ```
45+ \q
46+ ```
47+
48+ Or ` CTRL ` +` d ` .
49+
50+
51+ ## Users
52+
53+ ### Login
2254
2355Here we use a user named ` postgres ` .
2456
@@ -34,7 +66,7 @@ postgres=#
3466
3567This is implied for the rest of this guide.
3668
37- ## Create user
69+ ### Create user
3870
3971``` sql
4072CREATE USER postgres
@@ -46,9 +78,7 @@ CREATE USER foo WITH PASSWORD 'bar';
4678
4779https://www.postgresql.org/docs/current/app-createuser.html
4880
49-
50- ## Create role
51-
81+ ### Create role
5282
5383``` sql
5484CREATE ROLE foo LOGIN;
@@ -59,8 +89,7 @@ CREATE ROLE admin WITH CREATEDB CREATEROLE;
5989
6090https://www.postgresql.org/docs/current/sql-createrole.html
6191
62-
63- ## Change password
92+ ### Change password
6493
6594``` sql
6695ALTER USER postgres WITH PASSWORD ' newpass' ;
@@ -76,7 +105,7 @@ Set it interactively.
76105
77106https://serverfault.com/questions/110154/whats-the-default-superuser-username-password-for-postgres-after-a-new-install/325596
78107
79- ## List users
108+ ### List users
80109
81110``` sql
82111\du
You can’t perform that action at this time.
0 commit comments