Backup from VM and restore in local machine

Continuing the discussion from Restore from ERPnext Virtual Machine to Ubuntu new installation:

This is what I get when I run restore:

root@ahmed-Q500A:/home/ahmed/frappe-bench# ls
20141230_21537504_database.sql config env Procfile
apps config.json logs sites
root@ahmed-Q500A:/home/ahmed/frappe-bench# bench frappe --restore erpnext 20141230_21537504_database.sql
MySQL root password:
Traceback (most recent call last):
File “/home/ahmed/frappe-bench/env/bin/frappe”, line 9, in
load_entry_point(‘frappe==4.9.1’, ‘console_scripts’, ‘frappe’)()
File “/home/ahmed/frappe-bench/apps/frappe/frappe/cli.py”, line 54, in main
return run(fn, parsed_args)
File “/home/ahmed/frappe-bench/apps/frappe/frappe/cli.py”, line 82, in run
out = globals().get(fn)(*args.get(fn), **args)
File “/home/ahmed/frappe-bench/apps/frappe/frappe/cli.py”, line 68, in new_fn
return fn(*args, **new_kwargs)
File “/home/ahmed/frappe-bench/apps/frappe/frappe/cli.py”, line 387, in restore
_install(db_name, source_sql=source_sql, quiet=quiet, force=force)
File “/home/ahmed/frappe-bench/apps/frappe/frappe/cli.py”, line 318, in _install
admin_password = admin_password, verbose=verbose, force=force, site_config=site_config, reinstall=reinstall)
File “/home/ahmed/frappe-bench/apps/frappe/frappe/installer.py”, line 31, in install_db
create_database_and_user(force, verbose)
File “/home/ahmed/frappe-bench/apps/frappe/frappe/installer.py”, line 52, in create_database_and_user
raise Exception(“Database %s already exists” % (db_name,))
Exception: Database site3.local already exists

Just noted that VM is running old bench, while local machine runs new bench. I don’t know if this can cause trouble, but anyway I have updated bench on VM now.

Still no luck. I am stuck at this stage and will require your help.

Pass -f to ignore the the warning and replace current data,

bench frappe --restore site3.local 20141230_21537504_database.sql -f

I have done that, and it ends up in an error, something related to “access denied for user …”. Then when I try to log in from browser I get “Internal Server Error”.

Try the following,

bench new-site site4.local
bench frappe --restore site4.local /path/to/sql -f site4.local
bench set-default-site site4.local
bench setup nginx

Then
as root,

service nginx reload

You can then drop databases that aren;t required.

This worked. Thanks.

How can I drop the not required databases ?

Regards,

You can run drop database query as mysql root user. Be careful to not drop a system database or the database the production site you’re using.

can you share restore process in vm machine

Check this video

1 Like


this error is coming when downloading backup in vm?

i wanted to backup vm hosted erpnext and restore it to another vm.

@Rehan_Ansari

Just make a snapshot of the full VM instance and upload to new VM.

Hope it helps.