"The username is already being used" after reinstalling Nextcloud version

I needed to delete my whole installation and reinstall nextcloud. Upon opening /SERVERNAME/nextcloud it gives me the default starting screen where I entered the username AdminNextcloud. This is the same name I had used before I cleared all previous data (see Details below), yet I get stuck with the message “The username is already being used”. Where does Nextcloud keep finding that name? How do I delete ALL the previous installation without deleting maybe Apache and PHP?
I followed a great tutorial at https://pimylifeup.com/raspberry-pi-nextcloud-server/ to install nextcloud. After moving the installation to my external hard drive the dashboard came up, but no longer displayed even the default .jpg images. I decided to delete the installation and start again by using rm -r /var/www/nextcloud/* , rmdir nextcloud, removing the MariaDB nextcloud database (using DROP), clearing my browser cache and cookies, and unmounting my external hard drive. I then downloaded and reinstalled from the tarball, again following the initial tutorial.
Upon opening http://SERVERNAME/nextcloud it gives me the default setup screen where I entered the username AdminNextcloud as I had used before (all files containing that name should be gone, right?), yet I get stuck with the message “The username is already being used”. Where does Nextcloud keep finding that name? How do I delete ALL the previous installation so I can start again clean without maybe deleting Apache and PHP? I’d prefer not to just use a different admin name and would really like to find the answer to where this data remains on my system. Thanks!

@mworth Have you delete the data directory of nextcloud ?
if not, rename the directory nammed " AdminNextcloud" or delete it

Hello Mageunic, thanks for responding.
Yes, I deleted the entire /var/www/nextcloud/* directory, all files, and all subdirectories (including /var/www/nextcloud/data) before I reinstalled Nextcloud.
Any other thoughts?

This is really strange …
I suppose you have no log on it.

Correct. I searched through /var/www/nextcloud/data/nextcloud.log and there is no mention of AdminNextcloud. I couldn’t even find the error phrase “The username is already being used” in that log. I would think it should show up using the default logging level of 2. It’s strange.

Are you sure that you correctly cleared the db ? I had this very same error when the db wasn’t removed. You dropped the DB but maybe not the user in the db

Hi Berthou. I only dropped the DB. Perhaps I don’t understand enough about MariaDB, but I always thought that dropping a database (e.g. DROP DATABASE nextclouddb; ) would remove everything about it. Where else would the name be stored? I also deleted the entire nextcloud directory and all files from the filesystem, thinking all traces would be gone.

BTW, as a workaround, I just created a new admin user to complete installation. Once I got in I found that nextcloud still showed my previous admin user. Any ideas why that had been retained? Thanks for your help.

Hi Mworth,

The same kept happening to me, and I believe I’ve found what was causing this. Are you use REDIS in your docker setup? If so, turn it off, drop the DB (again, yes ;)), and then try again (of course after creating a new DB).

If you’re not having the issue anymore, hopefully this info might save someone else a couple of days ;(