Symptoms
Migration of a subscription fails with the following error:
PLESK_ERROR: Unable to create database user ‘john_doe’ in subscription ‘example.com’: Command execution failed on the local server with non-zero exit code.
command: /opt/psa/bin/database –create-dbuser john_doe -passwd ” -domain example.com -database example -type mysql -server localhost:3306 -ignore-nonexistent-options
exit code: 1
stdout:
stderr: Unable to add database user: The user john_doe already exists.
Cause
The database user from the error message already exists on the target server.
Database users must have unique names.
Resolution
Solution I
Remove the user john_doe on the destination server using following steps:
-
-
Connect to the destination Plesk server via SSH.
-
For security reasons, create a backup of the Plesk database:
# plesk db dump mysql > /root/mysql.sql
-
Connect to the Plesk database:
# plesk db
-
Open the mysql database:
MYSQL_LIN: > use mysql;
-
Remove the duplicate user:
MYSQL_LIN: > delete from user where user=’john_doe’;
-
Migrate the subscription again.
-
Â
Solution II
If it is needed to keep the user john_doe on the destination server, rename the database user on the source server and restart the migration.
Note: If the database username is used inside website code, change the username in the code as well.