set path
D:\DB\PostgreSQL\16\bin
connect to database
–h is host name
-p is port number
-d is database name
-U is for user name
psql -h localhost -p 5432 -d postgres -U postgres
查詢版本信息
select version();
PostgreSQL 8.4.20 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11), 64-bit
export dump file
參考
pg_dump -h 192.168.1.1 -U uesername dbname > dbname.pgsql
import dump file
./psql -U postgres dbname<d:/db.pgsql