Fresh install, lost sql password, import data from backup

Hi, I decided to reinstall my nextcloud and to restore my data folder. But I realized that my nextcloud sql password doesn’t work (I obtain SQL state access denied…) So how can I recover my data??

So my install with 11.0.3 and my data too.

I’m on Ubuntu 16.04 with mariaDB.

I write with general knowledge of mariaDB rather than of Nextcloud.

Have you tried to set a new password working directly with mariaDB as a superuser such as root and put it in /var/www/nextcloud/config/config.php? That should work as long as the password in /var/www/nextcloud/config/config.php is not encrypted.

Alternatively it may be possible, again working directly with mariaDB as a superuser such as root to:

  • Backup the Nextcloud database
  • Drop the Nextcloud database (named owncloud)
  • Drop the Nextcloud mariaDB user (normally admin)
  • Do a fresh Nextcloud installation (this will re-create admin with the password in both mariaDB and in /var/www/nextcloud/config/config.php)
  • Restore the Nextcloud database from backup.