Restore from backup - Permission Denied

I encountered this error after entering mySQL password. How to resolve this?

sh: 1: cannot open /home/frappe/back.sql: Permission denied
Database not installed, this can due to lack of permission, or that the database name exists.
Check your mysql root password, or use --force to reinstall

I used this code to restore.

bench --site [sitename] --force restore /path/to/SQLFILE

from which user you are executing the command ?

root user

switch to frappe user su frappe and then the above command

Did the following. Same result.

frappe@erptest-VirtualBox:~/frappe-bench$ bench --site site1.local --force restore /home/frappe/back.sql
MySQL root password:
sh: 1: cannot open /home/frappe/back.sql: Permission denied
Database not installed, this can due to lack of permission, or that the database name exists.
Check your mysql root password, or use --force to reinstall
frappe@erptest-VirtualBox:~/frappe-bench$

goto /home/frappe and post output for ls -l

frappe@erptest-VirtualBox:~$ ls -l
total 184320
-rw------- 1 root root 137047914 Jul 26 10:16 back.sql
-rwxr-xr-x 1 frappe frappe 8980 Oct 4 2013 examples.desktop
-rw------- 1 root root 44873564 Jul 26 10:17 files.zip
drwxr-xr-x 8 frappe frappe 4096 Jul 26 10:23 frappe-bench
-rw------- 1 root root 6792578 Jul 26 10:17 private.zip

sudo chown frappe:frappe back.sql
sudo chmod 644 back.sql

bench --site site1.local --force restore /home/frappe/back.sql
1 Like

I think it worked. But I encountered this.

frappe@erptest-VirtualBox:~/frappe-bench$ bench --site site1.local --force restore /home/frappe/back.sql
MySQL root password:
*** Scheduler is disabled ***
frappe@erptest-VirtualBox:~/frappe-bench$

Seems backup has been restored.

to enable scheduler bench enable-scheduler site1.local