Everyone has come across the frustraiting and annoying issue of trying to create an account and receiving an error during installation relating to the account creation failed existing already. The errors can vary but are all along the same lines: User already exists, This system already has a database owner named <blank>, etc etc. There are a million tutorials on this, but almost all of them lack all of the steps needed to fully remove an account with this problem. This usually happens because you were trying to previously create an account and stopped the process before letting it finished, or a backup restoration didnt completely finish and left remnants of the account behind.
To solve this issue, you have to remove all traces of the account. Be responsible and only do the following if you absolutely want to get rid of this account so you can now recreate the account and/or restore a backup you have.
First, login to shell as the root user
Then, edit each of these files, removing the cPanel accounts username from the entries and then saving the files:
Also, remove the entire directory in /home of the username. For example, if the username is “annoying”, you would delete the entire directory /home/annoying from your system.
Now you have to remove the MySQL database remnants. Type this in shell:
This then opens up MySQL. You will have a MySQL prompt. Type the following while in the MySQL prompt
mysql > use mysql;
mysql > delete from user where user=’USERNAME’;
mysql > exit;
This last line “exit;” brings you back to the normal shell prompt. Now some of you may have done te above and received errors, or messages that the database ‘annoying’ doesn’t exist. How annoying!. So do the following as a last step
Open these two files and check to see if the username is in there/var/cpanel/unknown/users.db/etc/dbowners
I can assure you it will be listed there 🙂
I hope this helps someone!