File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66zxy /*
77wealink /*
88password.py
9+ * .env
Original file line number Diff line number Diff line change @@ -648,13 +648,39 @@ psql (PostgreSQL) 9.3.9
648648\?:查看psql命令列表。
649649\l:列出所有数据库。
650650\c [database_name]:连接其他数据库。
651- \d:列出当前数据库的所有表格。
651+ \d:列出当前数据库的所有表,包括模式。
652+ \dt:列出当前数据库的所有表。
652653\d [table_name]:列出某一张表格的结构。
653654\du:列出所有用户。
654655\e:打开文本编辑器。
655656\conninfo:列出当前数据库和连接的信息。
656657```
657658
659+ 终端远程连接 postgres 命令
660+ ```
661+ $ psql -h [ip] -p[port] -U [user] -d [database]
662+ ```
663+
664+ 打开扩展,格式化显示查询结果,使用 \x 切换显示效果
665+ ```
666+ wl_crawl=# \x
667+ Expanded display is on.
668+ wl_crawl=# select * from [table] limit 10;
669+ wl_crawl=# \x
670+ Expanded display is off.
671+ wl_crawl=# select * from [table] limit 10;
672+ ```
673+
674+ psql 是一个普通的 PostgreSQL 客户端应用。
675+
676+ 为了与一个数据库联接,你需要知道你的目标数据库, 服务器的主机名和端口号以及你希望以哪个用户的身份进行联接等信息。
677+
678+ 我们可以通过命令行参数告诉 psql 这些信息,分别是 -d, -h,-p,和 -U。
679+
680+ 如果有个参数不属于任何选项开关, 那么它会被解释成数据库名(或者是用户名——如果数据库名称已经给出了。)
681+
682+ 所以,上面远程连接可以有很多写法,是很方便,但是建议指明参数,后面调试起来方便。
683+
658684
659685## Python MongoDB
660686
You can’t perform that action at this time.
0 commit comments