TechyTrois
  • Home
  • Our Services
  • Blog
  • About Us
  • Contact us
  • Client Login
Select Page

cPanel account restore issue – a mysql user with the name ” already exists

by admin | Mar 12, 2015 | cPanel/WHM | 2 comments

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 /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 !

 

2 Comments

  1. WebCraker
    WebCraker on October 16, 2018 at 3:18 am

    This sql command worked fine for me

    delete from User where User like ‘%user%’;

    Reply
  2. WebCraker
    WebCraker on April 23, 2017 at 2:10 pm

    This sql command worked fine for me

    delete from User where User like ‘%user%’;

    Reply

Submit a Comment Cancel reply

Recent Posts

  • Setting up Varnish in WHM – Cloudlinux Server
  • Simple backup script to offload WordPress daily backups to a remote server/storage
  • Virtualmin – not able to add more than 10 accounts !
  • VestaCP – Exim and dovecot issue
  • [proxy_http:error] cPanel creating Apache Proxy loop on Account transfers

Categories

  • Android
  • Apache
  • aws
  • cPanel/WHM
  • DNS
  • Firewall
  • General
  • IIS
  • Linux
  • Mail service
  • Microsoft Windows
  • MySQL
  • OpenSource
  • Plesk
  • Servers
  • SQL
  • SQL Server Management Studio
  • SSH
  • SSL
  • Ubuntu
  • Virtualmin
  • VMware
  • Windows 10
  • WordPress

Pages

  • About Us
  • Blog
  • Contact us
  • Home
  • Our Services
  • Our Services- INR
  • Privacy policy
  • Refund Policy
  • Terms and conditions

TechyTrois






 

Privacy Policy

Terms and conditions

Refund policy

© TechyTrois 2020-2021