Moving database directory to external USB drive

Hi,

I’ve setup my Nextcloud with the Fullimage (Nextcloud 12.0.4) on an raspberry pi 3 Model B with raspian stretch installed. Everything goes fine. The only thing what fails is moving the database from the SD Card to the external drive.

I’ve done it several times, and it’s always the same error. I also tried this solution:

Same error.

Here you see the complete Errormessage:

Your data directory is not writable
Permissions can usually be fixed by giving the webserver write access to the root directory.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:145
Stack trace:
#0 /var/www/nextcloud/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)
#2 {main}moving database to /media/USBdrive/ncdatabase…
mv: inter-device move failed: ‘/var/lib/mysql’ to ‘/media/USBdrive/ncdatabase’; unable to remove target: Read-only file system
Your data directory is not writable
Permissions can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/12/go.php?to=admin-dir_permissions.

An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/nextcloud/lib/private/Console/Application.php:145
Stack trace:
#0 /var/www/nextcloud/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)
#2 {main}

I don’t know what to do.

Thank you in advance!

André