"The username is already being used" (easy fix)

Im posting this because i have searched for a solution a long time and couldnt find a quick and easy fix yet an explanation what to do so i took the time to investigate and was able to solve it.
I use owncloud with Kubernetes and deleted a pod and the logs say “The username is already being used”

This means that the User you use to login into owncloud is already in use (not the database user from mysql) In this example its the user “admin”. It can be anything else you used in the previous instance of owncloud.

In order to fix it you need to stop your Pod, Deployment, Container or whatever you have currently running. Then login to the Database with your root user and start deleting the user from the owncloud database.


  2. USE owncloud;


  4. SELECT * FROM oc_users;

DELETE FROM oc_users
where uid = ‘admin’;

DELETE FROM oc_accounts
where user_id = ‘admin’;

DELETE FROM oc_group_user
where gid = ‘admin’;

Start owncloud and it will install successfully.

Keep in mind that the data from the user will be deleted, some app settings might be persistent.
An alternative way is to install owncloud with another admin user for example “admin2” and after initial installation you could login with “admin” and delete “admin2”

Have fun, good luck!