How to restore a database from a backup (bench backup & bench restore)?

The only workflow that really seems to work for me every time is as follows:

  1. cd frappe-bench
  2. bench backup

(and when ready to restore you first must decompress your backup.sql.gz file)

  1. gunzip yourbackupfile.sql.gz

(this creates the ,sql file from the compressed backup)

  1. sudo bench --force --site your.site.name restore /path.to.your.sql.file

You don’t actually create a blank db, You just force your restore file to overwrite the existing one.

The only thing you have to make sure of with a new installation is that you have passed through the setup wizard on the first login using the Administrator user. Once that is done you can overwrite the database with any valid (and version compatible) erpnext backup.

Hope this helps.

BKM

16 Likes