Backup/restore or migration failed with the following error:
Warning: database "DB_NAME"
Failed deployment of database user USER_NAME of database DB_NAME
Execution of /usr/local/psa/admin/plib/api-cli/database.php --update events -add_user USER_NAME -server localhost:3306 -type mysql -print-id -default -set-acl % -passwd '' -passwd_type sym -ignore-nonexistent-options failed with return code 1.
Unable to create database user: User with requested name already exists
User with requested name already exists.
- Database was not completely removed after previous failed attempts.
- The same username is used for another database.
mysqldatabases # 213904125
Login to Plesk database # 213928465 and ensure that the user
USER_NAMEis not used by any other databases in Plesk
mysql> select db.name as 'DB Name', u.login as 'DB User' from data_bases db, db_users u where db.default_user_id=u.id and u.login='USER_NAME';
2.1 If previous step showed that there is no any database connected then:
mysql> delete from mysql.user where User='USER_NAME';
mysql> delete from mysql.db where User='USER_NAME';
mysql> FLUSH PRIVILEGES;
mysql> delete from psa.db_users where login='USER_NAME';
Also remove user from
mysql> SELECT Host,User FROM mysql.user where User='USER_NAME';
| Host | User |
| localhost | USER_NAME |
mysql> DROP USER 'USER_NAME'@'localhost';
2.2 If an user with the same username manages another database on the server run the following to get conflicting database and domain name:
mysql> select name from domains where id in (select dom_id from data_bases where id in (select db_id from db_users where login ='username'));
mysql> select name from data_bases where id in (select db_id from db_users where login ='username');
On the domain management page go to Databases , select required database and change username to another.