Imagine that you’ve deleted an account via WHM. Now you need to recreate it again. Unfortunately, you got the following error message:
Account Creation Status: failed
A database owner with the name USERNAME already exists
Sometimes it happens because some configuration files were not removed from the account-deletion scripts. But here is the simple solution:
Navigate to /var/cpanel/databases:
cd /var/cpanel/databases
Find all files related to deleted USERNAME. You’ll see something like this:
USERNAME.cache
USERNAME.yaml
USERNAME.json
Delete these files.
Now, remove all entries related to USERNAME in these files:
/var/cpanel/databases/users.db
/etc/dbowners
To do it quicker, you can use a sed onliner:
sed -i '/USERNAME/d' /var/cpanel/databases/users.db
sed -i '/USERNAME/d' /etc/dbowners
After this you’ll be able to successfully recreate your terminated account via WHM.