Wordpress: Recovery from backup not possible - ERROR at line 1: Unknown command '\-'

I think you have a know issue with the db since mariadb have changed… like in this post Force Install YNH on debian 11 because backup - #3 by langer

You may do something like this connected on ssh and with the user root:

Perhaps you can first copy the backup file wordpress-pre-upgrade1.tar or wordpress-pre-upgrade2.tar in a folder wordpress-tar,

sudo -i
mkdir /root/wordpress-tar
cp -a /home/yunohost/backup.archives/wordpress-pre-upgrade1.tar /root/wordpress-tar

then extract the tar file

cd wordpress-tar
tar -xvf  wordpress-pre-upgrade1.tar  

edit the file and remove the first line ( should be something like /*!999999\- enable the sandbox mode */ )

nano wordpress-tar/apps/wordpress/backup/db.sql

with the editor nano on the cursor pointed to the line with /*!999999\- enable the sandbox mode */ you do Ctl + K to delete it and then Ctl + 0 to edit the changes Ctl + X to exit the editor

You can delete the file wordpress-pre-upgrade1.tar from the directory wordpress-tar

rm wordpress-tar/worpress-pre-upgrade1.tar

recreate the tar file

cd ..
$ tar -cf wordpress-pre-upgrade1.tar wordpress-tar

Then rename the original backup to keep it in secure place…

mv /home/yunohost.backup/archives/wordpress-pre-upgrade1.tar /home/yunohost.backup/archives/wordpress-pre-upgrade1.tar-ORI

and replace the new one edited on the folder archives

mv /root/wordpress-pre-upgrade1.tar /home/yunohost.backup/archives/

And try then restore the backup…

yunohost backup restore wordpress-pre-upgrade1.tar --apps

I think you can try these steps…