While restoring a cPanel account from one server to another server there is a chance for following error: Account Creation Status: failed (Sorry, a mysql user (let’s take ‘dbuser’) with the name already exists
To Delete the user :
Please login into the mysql and follow the steps
mysql
mysql > use mysql;
mysql > drop user dbuser@localhost;
OR
mysql> delete from mysql.user where user=dbuser;
You can also check this using :
select User, Host from user where User like dbuser;
Where dbuser is the user mentioned in the error.
If the above mentioned steps do not fix the issue,please follow the below steps.
Please check for entries of that usernames in the following files and if there is any, remove those entries.
/var/cpanel/databases/users.db
/etc/dbowners
After removing these entries, execute the following command.
userdel -f username