Applicable to:
- Plesk Onyx for Linux
Symptoms
-
Unable to migrate a database in Tools & Settings > Migration & Transfer Manager > source server or via Site import extension, when a database username has more than 16 characters:
PLESK_ERROR: Unable to create database user 'usernamewith16characters' in subscription 'example.com': Command execution failed on the local server with non-zero exit code.
command: /usr/local/psa/bin/database --create-dbuser usernamewith16characters -passwd '' -domain example.com -any-database -type mysql -server localhost:3306 -ignore-nonexistent-options
exit code: 1
stdout:
stderr: Unable to add database user: Database user name is invalid.
Cause
The issue is considered as a Plesk bug with id #PPM-1889 which is already fixed in Plesk Obsidian.
Resolution
Upgrade to Plesk Obsidian to use up to 32 characters in MySQL 5.7 or up to 80 characters in MariaDB 10.0 and higher versions:
As a workaround:
-
Connect to the server via SSH;
-
Upload the attached patched file and extract it:
# wget https://support.plesk.com/hc/en-us/article_attachments/115000725194/Checker.zip
# unzip Checker.zip -
Backup original file:
# mv /usr/local/psa/admin/plib/Checker.php{,.bak}
-
Replace original file with the fixed one:
# mv Checker.php /usr/local/psa/admin/plib/
-
Re-migrate databases.
Note: The fix works only for site import. It still will not be possible to create database user with the name containing more than 16 characters.
Workaround 1. Change database username on the source server so it will contain 16 characters or less.
Workaround 2. If MariaDB version is less then 10.0 installed on the target server, consider upgrading it:
How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.0/10.1/10.2 on Linux
Comments
9 comments
It looks like this fix does not work on the latest version anymore. When running a migration, the following command is shown with an error. When I executed this on command line, it fixed the issue. However, I still can not import long mysql names.
Hello,
You seem using Plesk Obsidian 18.0. That hotfix is not needed on Obsidian, it has new limits introduced already with 32 symbols for a database user name.
Hi Anton. I have the following error and that is why I got here. I have fixed this by shortening the username on the old server. The username was 18 characters long. The source server is cPanel.
@D Koop and @erdinckoc
Hi, What Plesk and OS version are you running? What version of MySQL or MariaDB is installed on your servers?
Hello,
I was able to get the same result, we will double check internally and update article here accordingly.
Daniel Koop we were able to reproduce the issue on the MariDB where its schema was not upgraded. Please try to execute the below command and then try to create database user from Plesk UI with a name >16 symbols:
MYSQL_PWD=$(cat /etc/psa/.psa.shadow) mysql_upgrade -uadmin
Hi Anton,
Thanks for your effort. However, this is the result. Note that I use it in combination with CloudLinux. Their upgrade system should have run the upgrade already. Should I use the --force flag?
Daniel
Hello,
Yes, please try with "--force".
Please sign in to leave a comment.