1.登陸
psql -h 127.0.0.1 -U postgres -p31800
postgres
--------------------------------------------------
(1)列出所有的數據庫
mysql: show databases
psql: \l或\list
(2)切換數據庫
mysql: use dbname
psql: \c dbname
(3)列出當前數據庫下的數據表
mysql: show tables
psql: \d
(4)列出指定表的所有字段
mysql: show columns from table name
psql: \d tablename
(5)查看指定表的基本情況
mysql: describe tablename
psql: \d+ tablename
psql: \d+ tablename
參考: https://www.jb51.net/article/60742.htm
6. 查看t_user_info表的進程:
查看t_user_info表的進程: SELECT * FROM pg_stat_activity where query ~ 't_user_info'; 有時候如果發現某一個表鎖住了,可以找到對應的進程,用如下命令中斷進程: select pg_terminate_backend('pid'); ————————————————
