简体   繁体   English

Heroku:下载和还原数据库

[英]Heroku: download and restore database

My heroku rails app has following database settings for production 我的heroku Rails应用程序具有用于生产的以下数据库设置

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

production:
  <<: *default
  database: db/production.sqlite3

As you can see there is no password in the database. 如您所见,数据库中没有密码。 I downloaded the database with the commands 我用命令下载了数据库

heroku pg:backups:capture    
heroku pg:backups:download

Now I want to restore the database, which command should I run to restore the database? 现在我想还原数据库,应该运行哪个命令来还原数据库?

This is what worked for me 这对我有用

pg_restore -d myapp_development -U rails_dev -C latest.dump

Here, my local development database myapp_development , local database username rails_dev and latest.dump is the backup database file downloaded from server. 在这里,我的本地开发数据库myapp_development ,本地数据库用户名rails_devlatest.dump是从服务器下载的备份数据库文件。 Command above ask for a password which should be the password associated with user rails_dev. 上面的命令要求输入密码,该密码应该是与用户rails_dev关联的密码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM