$ psql database_name -U myuser -h myhost # connect databse

\connect database_name # switch database

\du # list database roles, A role can be thought of as either a database user, or a group of database users, depending on how the role is set up.

\l # list all databases

\d # list all visible tables, views, sequences and foreign tables

\dt # list all tables in the current database

\dp # Lists tables, views and sequences with their associated access privileges.

\d+ table_name # describe table structure

\q # exit psql

\password postgres # change password for postgres



这篇文章: 有用 无用
创建 2017-03-16 06:42:47 / 更新 2017-04-20 02:02:26