postgresql备份数据库

备份数据库:pg_dump -U username -h localhost -f /me.sql 数据库名;

 

恢复数据库:psql -U username -h localhost -f /me.sql 数据库名

 

-h localhost 有的需要加,有的不需要加

 

备份某张表的数据:pg_dump -U username -t table -f /me.sql 数据库名

 

导入某张表的数据:psql -U username -f /me.sql 数据库名

 

Ubuntu中出现 pg_dump: [archiver (db)] connection to database "pgrouting" failed: FATAL:  Peer authentication failed for user "postgres" 时需要加 -h localhost

posted on 2017-03-23 16:08  斜月三星一太阳  阅读(370)  评论(0编辑  收藏  举报