November 30, 2021

Failed to create the account a database owner with the name already exists


Failed to create the account a database owner with the name already exists, When trying to restore an account from a backup file from WHM, do you face this error ?

 

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.

Steps to solve database owner with the name already exists

Login to MySQL shell :



# mysql -u root -p ( find MySQL password from /root/.my.cnf )
mysql> use mysql;
mysql> 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 ! and Failed to create the account a database owner with the name already exists solved.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *