Accidentally deleted Nextcloud docker config folder, how do I reconnect to db?

I accidentally deleted my configuration folder for the nextcloud docker, I was using mariaDB for the backend and that remains in tact.

When I try and connect to the database with the same user name it states the username is already being used.

How do I reconnect the the nextcloud installation to the database?

That is why you should have backup copies. If you actually do just revert that file from backup and I believe everything should take haul from there with maybe a restart to the instance?

If you don’t, now is the time to do that and take this as a lesson to have to rebuild the data base from ground 0 with the data and re setting up the settings by hand.

Figured it out, just had to create a new admin user, my old user is still admin and account is still there in the MariaDB database.

By running this against the database

select * from mysql.user;

I was able to see the old user in the db

It connected to the database and asked to upgrade. Unfortunately after upgrade it messed up 2FA on my account. So I had to disable that in the docker container.

docker exec -it nextcloud /bin/bash

Then in the container navigated to config/www/nextcloud folder. And in there I had to reinstall twofactor_totp, and then disable it.

sudo -u abc php occ app:install twofactor_totp
sudo -u abc php occ twofactorauth:disable someuser totp

After this I was able to log into my old account and the content was all there.

Now I need to change the admin account in the php.ini file to reflect my old user account and reinstall my plugins and 2FA.