When trying to restore an account from a backup file from WHM, do you face this error ?
Account Restore Failed: “Account failure: Failed to create the account: The system could not create the user “xxx” because it conflicts with an unmanaged MySQL database user.”
If you face this error, you might need to verify if there is a user with the above name which might have been the result of an improper termination of the account.
Login to MySQL shell :
mysql -u root -p ( find MySQL password from
select User, Host from user where User like '%xxx %'; ( Replace xxx with the user which you get when the error hits )
If the user exists, you might get a table like the following depending on the number of such ones :
| User | Host |
| xxxx| xx.xx.xx.xx |
| xxxx| host.hostname.com |
| xxxx| localhost |
Remove all these entries using commands similar to :
mysql> DROP USER 'xxxx'@'xx.xx.xx.xx'; ( the 2nd portion after @ indicates the IP address in this case )
mysql> DROP USER 'xxxx'@'host.hostname.com';
Query OK, 0 rows affected (0.01 sec)
mysql> DROP USER 'xxxx'@'localhost';
Query OK, 0 rows affected (0.00 sec)
Once this is completed, verify there are no more entries :
mysql> select User, Host from user where User like '%xxxx%';
Empty set (0.00 sec)
After this, attempt to restore the account from the backup.
If you still face an issue in restoring, check the file ‘/var/cpanel/databases/users.db‘ and make sure the user is not listed there.
You should be able to restore the account now !