[cPanel & WHM] MySQL User Restore Troubleshooting

While restoring MySQL or MariaDB database users, you might encounter the following error:

Error: The request failed. (Error ID: dde3fu) Ask your hosting provider to research this error in cPanel & WHM’s main error log.

This is a generic error from the cPanel API when JetBackup attempts to recreate the user, and/or restore privileges. To determine the actual error, first check the /usr/local/cpanel/logs/error_log for the database user you’re restoring.
You will see an error such as:

Cpanel::Exception/(XID vm9e99) This system will not add the database user “wp_8ian2” to the database “wp_nctui” because this user does not have a password.
at /usr/local/cpanel/Cpanel/Mysql.pm line 659.

The system received an error from the “MySQL” database “mysql”: ER_NONEXISTING_GRANT (There is no such grant defined for user 'prestashop_03fc' on host '1.1.1.1')
at /usr/local/cpanel/Cpanel/DBI.pm line 200.

Cpanel::Exception/(XID 3wa26u) This system will not add the database user “prestashop_03fc” to the database “prestashop_03fc” because this user does not have a password.


This indicates that the Database User exists, but no password is set in MySQL, so the cPanel API is preventing grants from being set.
Alternatively, it could indicate the MySQL user was manually deleted via a DELETE query without flushing privileges to apply the changes.

Step 1 - If affecting only a subset of MySQL Users

If you deleted the MySQL user manually, please note that cPanel & WHM will not be aware that the MySQL user was deleted because this information is cached. Please refrain from using DELETE queries in MySQL and instead use the cPanel API for DB user deletion.
To correct this, first verify that the user doesn’t exist in MySQL. Then, run the

/usr/local/cpanel/bin/restoregrants --db=mysql --cpuser=USER123 --all

If you follow these steps and still receive the error Cpanel::Exception/(XID 3wa26u) This system will not add the database user “prestashop_03fc” to the database “prestashop_03fc” because this user does not have a password. , this could be due to the query used to delete the users combined with an old MySQL bug. (1, 2)


To verify this, try creating the user manually in mysql. The user may not be listed in mysql.user, but still cannot be created.

mysql> select User, Host from mysql.user where User LIKE 'prestashop_%';
+----------------------------+-----------+
| User | Host |
+----------------------------+-----------+
| prestashop_I_wasnt_deleted | localhost |
+----------------------------+-----------+
1 row in set (0.00 sec)
mysql> create user 'prestashop_03fc'@'IP1';
ERROR 1396 (HY000): Operation CREATE USER failed for 'prestashop_03fc'@'IP1'
mysql> create user 'prestashop_03fc'@'localhost';
ERROR 1396 (HY000): Operation CREATE USER failed for 'prestashop_03fc'@'localhost'
mysql> create user 'prestashop_03fc'@'SERVERIP2';
ERROR 1396 (HY000): Operation CREATE USER failed for 'prestashop_03fc'@'SERVERIP2'
mysql> create user 'prestashop_03fc'@'server-hostname-1.cprapid.com';
ERROR 1396 (HY000): Operation CREATE USER failed for 'prestashop_03fc'@'server-hostname-1.cprapid.com'

 

To resolve this, please try deleting those users using the correct DROP USER query, along with FLUSH PRIVILEGES;


mysql> DROP user 'prestashop_03fc'@'IP1';
Query OK, 0 rows affected (0.01 sec)
mysql> DROP user 'prestashop_03fc'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> DROP user 'prestashop_03fc'@'ServerIP2';
Query OK, 0 rows affected (0.00 sec)
mysql> DROP user 'prestashop_03fc'@'server-hostname-1.cprapid.com';
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)
mysql> EXIT
Bye


Then, delete the user via the cPanel UAPI. This will clear any cached data and allow the user to be recreated.

uapi --user=prestashopc Mysql delete_user name=prestashop_03fc


Done! You’re now ready to restore the user in JetBackup 5!

MySQL Crashed and restoring database users isn't working, what do I do?

In a disaster, you might manually recover MySQL on the same server instead of deploying a new server. (ie, /var/lib/mysql mount crashed) In this situation, it’s highly likely that cPanel’s API will then return incorrect data for each MySQL user based on the state of that user before the crash or MySQL corruption. Subsequently, the cPanel API returning this cached data may cause errors when JetBackup tries to restore those Database Users, because JetBackup uses the cPanel API to create the user and apply grants.
To correct this, we need to rebuild the cPanel database map and update the database user cache using the steps below:

1. Make a backup of the cPanel databases directory:

cp -a /var/cpanel/databases/ /var/cpanel/databases.bkp

2. If the default MySQL user for the cPanel account doesn't exist in the mysql.user table, Restore the grants for the users.

for each in `awk '{print $2}' /etc/trueuserdomains` ; do /usr/local/cpanel/bin/restoregrants --db=mysql --cpuser=$each --all ; done

3. Then, Rebuild database map for all users https://support.cpanel.net/hc/en-us/articles/360052910273-How-to-rebuild-a-cPanel-user-s-database-map-
To run this for all users use the command:

for each in `awk '{print $2}' /etc/trueuserdomains`; do /scripts/rebuild_dbmap $each; done

4. Now, run the update_db_cache script:

/scripts/update_db_cache

5. You should be able to restore the DB users with JetBackup 5. If you encounter any issues, please contact your database administrator for assistance.

 


If you see the error below, this normally means the default “validate_password” plugin in MySQL is preventing cPanel & WHM from creating the users, despite using a password that meets cPanel’s MySQL user password requirements.

[2024-08-27 13:53:46 -0700] info [cpwrapd] Creating MySQL virtual user wp_umjkn for user account24
[2024-08-27 13:53:46 -0700] warn [cpwrapd] Error from MySQL query: (XID macug5) The system received an error from the “MySQL” database “mysql”: 1819 (Your password does not satisfy the current policy requirements)
[2024-08-27 13:53:46 -0700] warn [cpwrapd] GRANT statement “CREATE USER 'wp_umjkn'@'localhost' IDENTIFIED BY 'SECURE_PASSW0RD';” failed:
[2024-08-27 13:53:46 -0700] warn [cpwrapd] Error from MySQL query: (XID sypkjf) The system received an error from the “MySQL” database “mysql”: 1819 (Your password does not satisfy the current policy requirements)
[2024-08-27 13:53:46 -0700] warn [cpwrapd] GRANT statement “GRANT USAGE ON *.* TO 'wp_umjkn'@'localhost','wp_umjkn'@'192.168.13.100','wp_umjkn'@'1-1-1-1.cprapid.com','wp_umjkn'@'1.1.1.1';” failed:

 


Please follow the guide here to resolve the MySQL user creation error:

https://support.cpanel.net/hc/en-us/articles/360053271934-MySQL-Your-password-does-not-satisfy-the-current-policy-requirements

  • 0 istifadəçi bunu faydalı hesab edir
Bu cavab sizə kömək etdi?

Uyğun məqalələr

Orphan Accounts Missing

Sometimes terminated accounts will not appear in the Orphan Accounts Section. Please verify the...

Orphan Accounts Missing

Sometimes terminated accounts will not appear in the Orphan Accounts Section. Please verify the...

No configuration files found

When performing a Disaster Recovery the error you may receive the following error:...

System File Restore

JetBackup 4 and JetBackup 5 allow you to create Directories Backup Job that can backup system...

cPanel Email Account Already Exists

There are times when restoring email accounts will result in the following error: [ERROR] Error...