Cannot restore from one server to another

Hey Folks,

I am struggling with restoring ERPNext from one server to another.

I am facing the “Site ****** already exist” issue.

Can you help me with this?

Here’s the correct command:

$ bench --site "sitename" --force restore "backup database location"
$ bench migrate

Hi @flexy2ky,

Thank you for your reply.

I am using bench version 4.1.0.

following are the only option available in “bench restore” command

Usage: bench  restore [OPTIONS] SQL_FILE_PATH

  Restore site database from an sql file

  --mariadb-root-username TEXT  Root username for MariaDB
  --mariadb-root-password TEXT  Root password for MariaDB
  --db-name TEXT                Database name for site in case it is a new one
  --admin-password TEXT         Administrator password for new site
  --install-app TEXT            Install app after installation
  --with-public-files TEXT      Restores the public files of the site, given
                                path to its tar file
  --with-private-files TEXT     Restores the private files of the site, given
                                path to its tar file
  --help                        Show this message and exit.

Oh wow!!! I started using ERPNext from V9 and the restore command was simplified. So unfortunately I cannot help you there as I don’t know what you need to do to restore V4.


Why not use the command line and issue the direct command to mariadb?

It looks something like this:

mysqlimport -u root -pYourPassword 1bd3e0294da19198 < /home/def_user/your.sql


  • there is a space between the -u and the root user name
  • there is no space between the -p and the mariadb password
  • the long random string is the database name that you can find in site)config.json
  • and the end of the command is the path to your sql file

It is worth a shot at least. I am not sure about where you are in the mariadb versions but I would try it anyway.




Awesome, It worked like a charm.

Big applause.

Thank you very much

You are very much welcome. :grin:

Remember to also move the files in the /public/files and the /private/files directories tied ti the original site. This will be important to the long term usefulness of the system.

Also… Go get the encryption key field form the site_config.json on the original site and paste in into the new server so that email and other important functions will work properly.

And finally, remember to make copies of any original file before you edit it just in case you ned to go backwards.

BKM :sunglasses:


Thank you very much.

I had already taken care of all above mentioned things.

Thumbs up::+1:

Hello, Experts

I am new in ERPNext my issue is i want to transfer Public/Private folder and db as on date move automatically to my testing server periodically for e.g. daily/weekly.

How i can ?? Please help …

Thanks in advance