[英]importing postgres database dump to local app
I have a db dump in pg from heroku.我有一个来自 heroku 的 pg 数据库转储。 I want to use that db locally as well.
我也想在本地使用该数据库。
How can we have that database dump imported locally using pgadmin
我们如何使用
pgadmin
在本地导入数据库转储
You can create a database in PG
and make the dump import to that database您可以在
PG
创建一个数据库并将转储导入该数据库
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [database name] latest.dump
For references you can view this blog: https://cbabhusal.wordpress.com/2016/01/22/heroku-postgresql-dump-production-staging-database-to-localhost/有关参考,您可以查看此博客: https : //cbabhusal.wordpress.com/2016/01/22/heroku-postgresql-dump-production-staging-database-to-localhost/
Use this command for restoring使用此命令进行恢复
'pg_restore -i -h localhost -p 5432 -U postgres_user_name -d database_name -v “LATEST_DUMP_PATH”' 'pg_restore -i -h localhost -p 5432 -U postgres_user_name -d database_name -v “LATEST_DUMP_PATH”'
我使用以下内容,简单明了:
pg_restore -d database_name -c ~/database.dump
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.