登陸mysql
psql -U user [-d dbname]
切換數據庫,至關於mysql的use dbnamesql
\c dbname
列舉數據庫,至關於mysql的show databases數據庫
\l
列舉表,至關於mysql的show tablespost
\dt
查看錶結構,至關於desc tblname,show columns from tbnamecode
\d tblname
查看索引 索引
\di
導入table
psql -U username -W -d dbname -f xx.sql
psql -U username database(defailt username) < /data/dum.sql
xzcat /data/dum.sql.xz | psql -h localhost -U username database(default username)
導出class
pg_dump -h localhost -U username database(default postgres) >/data/dum.sql
pg_dump -h localhost -U username database(default username) -t table >/data/dum.sql
xz dum.sql