Fail to restore database ERPNext 10.1.x to 12.13

I tried to move 2 sites to a new server by restoring database. The sites are from 1 bench using multi tenants. And the servers have different domain name.

Yesterday I can restore the 1st site using:

bench --site sitename restore path/to/backup/file

but when restoring the 2nd using the same command I got this message and no database is restored:

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 took the sql from this directory sites/sitename/private/backups/dbname.sql.gz.
I tried both files created by automatic backup and the file created from bench backup.

The process seemed removing the tables from database but not restoring any from the sql file.

I tried to use --force but the same message.
From Restore from backup - Permission Denied there is suggestion to chown and chmod but still the same result.

The message is vague of what is wrong:

  • lack of permission: which permission? MariaDB or bench? On old file or the new site?
  • database name exists: which name? the site with the old name? or the new site db name? I tried to use sites with different sitename and the same sitename, both still failed.
  • Check mysql root password: old or new sql? what if I don’t use the option --mariadb-root-password?
  • use --force to reinstall: to reinstall site or to restore? both have --force option.

Frappe version: 10.1.6 (old) to 12.11.0 (new)
ERPNext version: 10.1.13 (old) to 12.13.0 (new)
Bench version: 4.1.0 (old) to 5.2.1 (new)

I dont’ think compatibility is the problem because I can restore the first site but not the second.

Can anyone please explain what is happening and how to resolve?
Thank you very much.

Maybe you could check Step 3 and 4 in this tutorial:

Thanks @Paul_Frydlewicz for your suggestion.
But it doesn’t really relevant to my problem because both my servers are in operation. I just want to move sites from one operational server to another operational server.
So the mariadb is working well on both servers. And both have sites in operation.
My guess is in the bench reading the sql file. But what is exactly and where to look into.
Also wondering is how the first site can be restored, while the second site can’t.

Clearly is a MySQL problem.
If your ip addresses for current and previous deployment are different… Have you whitelisted/ ip addresses for the mysql user account.
Try running simple MySQL query with the same user to diagnose.

Check if this helps?

Edit: use bench new-site to restore db into site that doesn’t exist yet

Still gets the same message + error message:

ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''.
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

How can ip address affecting the restore process?
And why the first site can while the second can’t?

Similar error and solution:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.